[issue12801] C realpath not used by os.path.realpath

STINNER Victor report at bugs.python.org
Wed Feb 22 00:51:29 CET 2012


STINNER Victor <victor.stinner at gmail.com> added the comment:

realpath.patch:

 - Add os.realpath()
 - posixpath.realpath() uses os.realpath(), or os.getcwd() if the path is an empty string
 - os.realpath() uses canonicalize_file_name() if available, or use realpath() with a buffer of MAXPATHLEN bytes

Don't use realpath(path, NULL) because it is not possible to test if realpath() supports NULL: OpenBSD did segfault if the buffer was NULL. Testing the support in configure is not a good idea because it depends on the version of the C library. You may use a more recent C library to compile Python for example.

genericpath, macpath and os2emxpath are not patched to use os.realpath(), even if it is available. I don't know if these modules should be patched. ntpath uses the native Windows function (if available): GetFullPathNameW().

----------
Added file: http://bugs.python.org/file24596/realpath.path

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12801>
_______________________________________


More information about the Python-bugs-list mailing list