[ python-Bugs-1611154 ] os.path.exists("file/") failure on Solaris 9

SourceForge.net noreply at sourceforge.net
Thu Dec 7 23:25:27 CET 2006


Bugs item #1611154, was opened at 2006-12-07 22:25
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1611154&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Paul Eggert (eggert)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.path.exists("file/") failure on Solaris 9

Initial Comment:
Solaris 9 and earlier fail to conform to POSIX, in that
stat("FILE/") succeeds even when FILE is not a directory.
POSIX says that in this case it should fail.  This problem causes os.path.exists("FILE/") to succeed when it should fail, which makes it harder to write portable Python code.  One of my students ran into this problem when doing a Django-based project: his code ran fine on his Linux box, but failed when he attempted to run it on the Solaris 8 server that is the standard platform for our students.

To reproduce the problem, on Solaris 8 (or 9):

$ touch file
$ ls -l file
-rw-rw-r-- 1 eggert csfac 0 Dec  7 14:19 file
$ python
Python 2.5 (r25:51908, Dec  7 2006, 13:14:10)
[GCC 4.1.1] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.exists("file/")
True

It should be False.

I'll attach a patch that works around the problem at
run-time.  If you prefer something that tests for it
at compile time please let me know.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1611154&group_id=5470


More information about the Python-bugs-list mailing list