[Python-bugs-list] [ python-Bugs-542314 ] long file name support broken in windows
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 10 Apr 2002 21:26:22 -0700
Bugs item #542314, was opened at 2002-04-11 14:23
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=542314&group_id=5470
Category: None
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark Hammond (mhammond)
Assigned to: Nobody/Anonymous (nobody)
Summary: long file name support broken in windows
Initial Comment:
>From c.l.py, thread ""
Peter D:
I'm using windows and trying to call os.path.getmtime
() after using os.path.walk... However, I'm choking
with "[Errno 38] Filename too long" on paths with len
> ~260
Adding Martin's reply in a new comment (so it is not
at the top of each and every mail I get on this bug :)
----------------------------------------------------------------------
>Comment By: Mark Hammond (mhammond)
Date: 2002-04-11 14:26
Message:
Logged In: YES
user_id=14198
Martin v. Loewis's reply on c.l.py:
Since you are asking for a work-around: cd into one of the
more nested directories when the path gets longer
(os.chdir), and use relative paths from then on.
If you want to study how to solve the problem: the relevant
code snippet is in Modules/posixmodule.c
/* the library call can blow up if the file name is
too long! */
if (pathlen > MAX_PATH) {
PyMem_Free(pathfree);
errno = ENAMETOOLONG;
return posix_error();
}
There might be different ways to approach this:
- challenge the correctness of the comment:
- try to establish why the author of that code
thought that the C library could blow up
- analyse whether these arguments are still true
with the current compiler version
-or-
- prove the argument wrong by analysing the source
code of the C library
- then remove the constraint
-or-
- use different API to achieve the same effect without
suffering from the constraint.
I'm serious about these suggestions: users would appreciate
if this gets fixed somehow - apparently, the system allows
longer file names, and apparently, the system itself can
deal with that quite well. This
can be only true if the system either doesn't use its C
library, or if the C library does not have this restriction.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=542314&group_id=5470