[issue23407] os.walk always follows Windows junctions

2021-05-02 Thread Eryk Sun
Eryk Sun added the comment: Windows implements filesystem symlinks and mountpoints as name-surrogate reparse points. Python 3.8 introduced behavior changes to how reparse points are supported, but the stat st_mode value still sets S_IFLNK only for actual symlinks, not for mountpoints. This e

[issue23407] os.walk always follows Windows junctions

2021-05-02 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg389286 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue23407] os.walk always follows Windows junctions

2021-03-22 Thread Eryk Sun
Eryk Sun added the comment: Python 3.8 introduced some behavior changes to how reparse points are supported, but generalized support for handling name-surrogate reparse points as symlinks was not implemented. Python continues to set S_IFLNK in st_mode only for IO_REPARSE_TAG_SYMLINK reparse

[issue23407] os.walk always follows Windows junctions

2019-11-18 Thread Steve Dower
Steve Dower added the comment: At a minimum, it needs to be turned into a GitHub PR. We've made some significant changes in this area in 3.8, so possibly the best available code is now in shutil.rmtree (or shutil.copytree) rather than the older patch files. -- _

[issue23407] os.walk always follows Windows junctions

2019-11-15 Thread Jim Carroll
Jim Carroll added the comment: I can confirm the os.walk() behavior still exists on 3.8. Just curious on the status of the patch? -- nosy: +jamercee ___ Python tracker ___ __

[issue23407] os.walk always follows Windows junctions

2017-03-10 Thread Craig Holmquist
Changes by Craig Holmquist : Added file: http://bugs.python.org/file46718/issue23407-5.patch ___ Python tracker ___ ___ Python-bugs-list maili

[issue23407] os.walk always follows Windows junctions

2017-01-14 Thread Eryk Sun
Eryk Sun added the comment: Craig, can you add a patch for issue 29248, including a test based on the "All Users" link? -- dependencies: +os.readlink fails on Windows ___ Python tracker ___

[issue23407] os.walk always follows Windows junctions

2017-01-14 Thread Craig Holmquist
Craig Holmquist added the comment: New patch with spaces instead of tabs -- Added file: http://bugs.python.org/file46291/issue23407-4.patch ___ Python tracker ___ ___

[issue23407] os.walk always follows Windows junctions

2017-01-14 Thread Craig Holmquist
Craig Holmquist added the comment: Here's a new patch: now, _Py_attribute_data_to_stat and Py_DeleteFileW will just use the IsReparseTagNameSurrogate macro to determine if the file is a link, so os.walk etc. will know not to follow them. os.readlink, however, will only work with junctions an

[issue23407] os.walk always follows Windows junctions

2017-01-13 Thread Craig Holmquist
Craig Holmquist added the comment: FWIW, the only name-surrogate tags in the user-mode SDK headers (specifically winnt.h) are IO_REPARSE_TAG_MOUNT_POINT and IO_REPARSE_TAG_SYMLINK, as of at least the Windows 8.1 SDK. -- ___ Python tracker

[issue23407] os.walk always follows Windows junctions

2017-01-12 Thread Eryk Sun
Eryk Sun added the comment: I simply listed the tags that have the name-surrogate bit set out of those defined in km\ntifs.h. To keeps things simple it might be better to only include Microsoft tags (i.e. bit 31 is set). That way we don't have to deal with REPARSE_GUID_DATA_BUFFER struct tha

[issue23407] os.walk always follows Windows junctions

2017-01-12 Thread Craig Holmquist
Craig Holmquist added the comment: Can you point me toward any documentation on the additional tags you want to support? Searching for IO_REPARSE_TAG_IIS_CACHE mostly seems to yield header files that define it (and nothing at all on MSDN), and the non-Microsoft tags just yield a few results e

[issue23407] os.walk always follows Windows junctions

2017-01-12 Thread Eryk Sun
Eryk Sun added the comment: I opened issue 29248 for the os.readlink bug and issue 29250 for the inconsistency between os.path.islink and os.stat. Handling junctions as links is new behavior, so I've changed this issue to be an enhancement for 3.7. If the notion of a link is generalized to ju

[issue23407] os.walk always follows Windows junctions

2017-01-11 Thread Eric Fahlgren
Eric Fahlgren added the comment: > # Junctions are not recognized as links. > self.assertFalse(os.path.islink(self.junction)) If the above comment is intended as a statement of fact, then it's inconsistent with the implementation of Py_DeleteFileW ( https://hg.python.org/cpython/file/v

[issue23407] os.walk always follows Windows junctions

2016-09-25 Thread Craig Holmquist
Craig Holmquist added the comment: Updated patch with changes to Win32JunctionTests. -- Added file: http://bugs.python.org/file44824/issue23407-2.patch ___ Python tracker ___ ___

[issue23407] os.walk always follows Windows junctions

2016-09-25 Thread Craig Holmquist
Craig Holmquist added the comment: Actually, it looks like there is already a way to create junctions and a test for them in test_os. However, it includes this line: # Junctions are not recognized as links. self.assertFalse(os.path.islink(self.junction)) That suggests the old behavior

[issue23407] os.walk always follows Windows junctions

2016-09-25 Thread Craig Holmquist
Craig Holmquist added the comment: The attached patch changes _Py_attribute_data_to_stat to set S_IFLNK for both symlinks and junctions, and changes win_readlink to return the target path for junctions (IO_REPARSE_TAG_MOUNT_POINT) as well as symlinks. I'm not sure what to do as far as adding a

[issue23407] os.walk always follows Windows junctions

2015-02-07 Thread eryksun
eryksun added the comment: To check for a link on Windows, os.walk calls ntpath.islink, which calls os.lstat. Currently the os.lstat implementation only sets S_IFLNK for symbolic links. attribute_data_to_stat could also check for junctions (IO_REPARSE_TAG_MOUNT_POINT). For consistency, os.read

[issue23407] os.walk always follows Windows junctions

2015-02-07 Thread Craig Holmquist
New submission from Craig Holmquist: os.walk follows Windows junctions even if followlinks is False: >>> import os >>> appdata = os.environ['LOCALAPPDATA'] >>> for root, dirs, files in os.walk(appdata, followlinks=False): ... print(root) C:\Users\Test\AppData\Local C:\Users\Test\AppData\Loc