Author brian.curtin
Recipients brian.curtin, eric.smith, georg.brandl, jason.coombs, loewis, nadeem.vawda, ocean-city, santoso.wijaya
Date 2011-06-02.23:15:55
SpamBayes Score 1.11188e-11
Marked as misclassified No
Message-id <1307056558.43.0.991148721675.issue12084@psf.upfronthosting.co.za>
In-reply-to
Content
Attached is a complete patch. All tests pass.

Lib/test/support.py
 * Handle AttributeError, which Hirokazu noticed on pre-XP machines

Lib/test/test_os.py
 * This sets up a three-deep directory tree and creates a symbolic link in the middle (second) directory.
 * os.stat calls are tested from below, equal to, and above the symbolic link to make sure they work. This is what was broken with the previous os.stat implementation on Windows, as it used a method which only provided correct information (the reparse tag) when the stat call was made from the directory where the link originates from.

Modules/posixmodule.c
 * win32_read_link, now called win32_get_reparse_tag, was changed to just get the reparse tag and that's it. The tag is now only used when setting the mode attribute based on if the tag shows that this is a symlink directory or file.

 * The GetFinalPathNameByHandle dynamic loading and preparing was moved up in the file since it is again used for stat calls.

 * I removed the major duplication of stat implementations for both narrow and wide paths. Now there is just one implementation, win32_xstat_impl, which accepts a wide path and does the same work.

 * win32_xstat_impl now takes an approach where if there's a symlink to be traversed, e.g., for an os.stat call, the path is then re-opened without the flag to open the reparse tag, effectively following the link path. Then we pass the newly opened file handle to GetFinalPathNameByHandle and we can get back the target path, which we then pass recursively. There's no more depth stuff - we either try to follow the link in the above fashion or not.

 * win32_lstat was never being called from anywhere so it was removed.

 * win32_stat, which takes a narrow path, is now converted early to a wide path and passed into the win32_xstat_impl rather than maintaining two of the same functions like before.
History
Date User Action Args
2011-06-02 23:15:59brian.curtinsetrecipients: + brian.curtin, loewis, georg.brandl, jason.coombs, ocean-city, eric.smith, nadeem.vawda, santoso.wijaya
2011-06-02 23:15:58brian.curtinsetmessageid: <1307056558.43.0.991148721675.issue12084@psf.upfronthosting.co.za>
2011-06-02 23:15:57brian.curtinlinkissue12084 messages
2011-06-02 23:15:57brian.curtincreate