[ python-Bugs-1431582 ] long path support in win32 part of os.listdir(posixmodule.c)

SourceForge.net noreply at sourceforge.net
Wed Feb 15 11:14:29 CET 2006


Bugs item #1431582, was opened at 2006-02-14 18:44
Message generated for change (Settings changed) made by fidoman
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1431582&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: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Sergey Dorofeev (fidoman)
>Assigned to: Martin v. Löwis (loewis)
Summary: long path support in win32 part of os.listdir(posixmodule.c)

Initial Comment:
When passing path to os.listdir that is longer then 
MAX_PATH (what is supported in Windows API, 
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/fileio/fs/naming_a_file.asp) the 
path is truncated at position MAX_PATH=260 and 
appended with "/*.*", so underlying Windows API 
function FindFirstFileW gets garbage on input: 
original path truncated, and symbol "/" is added, 
which may not be used as path separator in long path.
I think posix_listdir should or raise error when 
getting extra long string, or pass it unchanged to 
underlying API.
Affected code is in Modules\posixmodule.c, lines 1470-
1478 (Python 2.4.2).
I think there is enough to change base when 
calculating size of allocated memory and copied block 
from fixed value of MAX_PATH to length of passed to 
function string.
And use os.sep instead of "/", of course.


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

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


More information about the Python-bugs-list mailing list