Bugs item #1532920, was opened at 2006-08-02 07:13
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1532920&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.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: lplatypus (ldeller)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.path.isfile('CON:') does not behave as documented

Initial Comment:
In Windows, os.path.isfile() returns True for device
filenames such as 'CON:', 'NUL:', 'AUX:', 'PRN:', and
'C:\\Program Files\\con.mp3'.

The documentation for os.path.isfile() says that it
returns True only for regular files, so it should
return False for the above examples (or else the
documentation should be amended).  In Linux,
os.path.isfile('/dev/null') returns False as expected.

This problem occurs because the “stat” function in
Microsoft’s C library behaves differently than in *nix.
 Quoting from Microsoft's documentation for stat:
    “st_mode: ... the _S_IFREG bit is set if path
specifies an ordinary file or a device”

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__stat.2c_._wstat.2c_._stati64.2c_._wstati64.asp

A similar problem exists with
stat.S_ISREG(os.stat('CON:').st_mode)


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

>Comment By: Martin v. Löwis (loewis)
Date: 2006-08-16 15:22

Message:
Logged In: YES 
user_id=21627

This is fixed in Python 2.5, which dropped usage of the
mscvrt stat implementation.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1532920&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to