This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: long path support in win32 part of os.listdir(posixmodule.c)
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: fidoman, loewis
Priority: high Keywords:

Created on 2006-02-14 15:44 by fidoman, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg27516 - (view) Author: Sergey Dorofeev (fidoman) Date: 2006-02-14 15:44
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.
msg27517 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-05-12 13:58
Logged In: YES 
user_id=21627

This has been fixed in r45973.
History
Date User Action Args
2022-04-11 14:56:15adminsetgithub: 42900
2006-02-14 15:44:02fidomancreate