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.

classification
Title: Symlink to directory on Windows 8
Type: behavior Stage: needs patch
Components: Tests, Windows Versions: Python 3.6, Python 3.4, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: izbyshev, paul.moore, python-dev, serhiy.storchaka, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2015-03-29 18:45 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 2475 vstinner, 2017-06-28 17:13
Messages (5)
msg239506 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-03-29 18:45
Looks as a symlink on Windows 8 can has the FILE_ATTRIBUTE_DIRECTORY flag.

http://buildbot.python.org/all/builders/AMD64%20Windows8%203.4/builds/348/steps/test/logs/stdio
======================================================================
FAIL: test_walk_bottom_up (test.test_os.WalkTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.4.bolen-windows8\build\lib\test\test_os.py", line 802, in test_walk_bottom_up
    self.sub2_tree)
AssertionError: Tuples differ: ('@test_3872_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3']) != ('@test_3872_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])

First differing element 1:
['broken_link', 'link']
['link']

- ('@test_3872_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3'])
?                                                 ----------

+ ('@test_3872_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])
?                                 ++++++++++


======================================================================
FAIL: test_walk_prune (test.test_os.WalkTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.4.bolen-windows8\build\lib\test\test_os.py", line 782, in test_walk_prune
    self.assertEqual(all[1], self.sub2_tree)
AssertionError: Tuples differ: ('@test_3872_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3']) != ('@test_3872_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])

First differing element 1:
['broken_link', 'link']
['link']

- ('@test_3872_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3'])
?                                                 ----------

+ ('@test_3872_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])
?                                 ++++++++++


======================================================================
FAIL: test_walk_topdown (test.test_os.WalkTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\buildarea\3.4.bolen-windows8\build\lib\test\test_os.py", line 765, in test_walk_topdown
    self.assertEqual(all[3 - 2 * flipped], self.sub2_tree)
AssertionError: Tuples differ: ('@test_3872_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3']) != ('@test_3872_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])

First differing element 1:
['broken_link', 'link']
['link']

- ('@test_3872_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3'])
?                                                 ----------

+ ('@test_3872_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])
?                                 ++++++++++


----------------------------------------------------------------------

Create broken link:

    os.symlink('non_existing_patch', 'broken_link', target_is_directory=True)

What return os.path.isdir('broken_link')?
msg239510 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2015-03-29 19:12
It returns True.
msg239514 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-03-29 19:27
Then tests should be adapted for Windows 8.
msg261361 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-08 14:13
New changeset 19a3e0e664af by Serhiy Storchaka in branch '3.4':
Issues #23808, #25911: Trying to fix walk tests on Windows.
https://hg.python.org/cpython/rev/19a3e0e664af

New changeset f9e22717722d by Serhiy Storchaka in branch '3.5':
Issues #23808, #25911: Trying to fix walk tests on Windows.
https://hg.python.org/cpython/rev/f9e22717722d

New changeset da020e408c7f by Serhiy Storchaka in branch 'default':
Issues #23808, #25911: Trying to fix walk tests on Windows.
https://hg.python.org/cpython/rev/da020e408c7f
msg312948 - (view) Author: Alexey Izbyshev (izbyshev) * (Python triager) Date: 2018-02-26 20:20
This behavior is not specific to just Windows 8. Symlinks to directories are treated as directories on Windows, in particular, they should be removed with RemoveDirectory, not DeleteFile.

Is there any reason this issue is still open?
History
Date User Action Args
2022-04-11 14:58:14adminsetgithub: 67996
2018-02-26 20:20:15izbyshevsetnosy: + izbyshev
messages: + msg312948
2017-06-28 17:13:22vstinnersetpull_requests: + pull_request2535
2016-03-08 14:13:10python-devsetnosy: + python-dev
messages: + msg261361
2015-12-20 12:05:43serhiy.storchakasettype: behavior
versions: + Python 3.6
2015-03-29 19:27:32serhiy.storchakasetmessages: + msg239514
stage: needs patch
2015-03-29 19:12:17paul.mooresetmessages: + msg239510
2015-03-29 18:45:10serhiy.storchakacreate