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.

Author jaraco
Recipients giampaolo.rodola, jafo, jaraco, lemburg, loewis, nnorwitz, swarren
Date 2009-05-31.20:47:31
SpamBayes Score 8.576473e-14
Marked as misclassified No
Message-id <1243802857.14.0.722662537346.issue1578269@psf.upfronthosting.co.za>
In-reply-to
Content
I've completed another draft patch.  This new one separates the
implementation of lstat and stat for windows, the latter which traverses
symlinks for the target.

I've tested this.  It compiles and runs under Windows Vista.  It works
correctly with file symlinks.  It fails to correctly detect that a
directory symlink is a symlink.  This is due to the fact that Windows
symlinks can also be directories, and the os.islink which calls
stat.S_ISLNK doesn't mask out the directory bit when checking for
symlinkness.

I see a few possible solutions:

1) Change S_ISLNK to mask of the directory bit when in Windows.
2) Change os.islink to perform a different test when in Windows.
3) Change the implementation of win32_lstat and win32_lstat_w to erase
the directory bit when the path is a link.

At first glance, option 3 seems the most promising, but it hides the
fact that Windows cares about the directoryness of a symlink.  It is
possible, for example, to have a "directory symlink" referring to a file
object in the file system.  S_ISDIR would be true for the symlink and
false for the target.

I think I'm going to implement approach 3 in a subsequent patch unless I
hear objections.

I also still need to implement Martin's two suggestions (release
kernel32 handle, inline functions).

But I wanted to share this patch for any suggestions.
History
Date User Action Args
2009-05-31 20:47:37jaracosetrecipients: + jaraco, lemburg, loewis, nnorwitz, jafo, giampaolo.rodola, swarren
2009-05-31 20:47:37jaracosetmessageid: <1243802857.14.0.722662537346.issue1578269@psf.upfronthosting.co.za>
2009-05-31 20:47:36jaracolinkissue1578269 messages
2009-05-31 20:47:34jaracocreate