python / cpython

The Python programming language
https://www.python.org
Other
63.53k stars 30.44k forks source link

Symlink to directory on Windows 8 #67996

Open serhiy-storchaka opened 9 years ago

serhiy-storchaka commented 9 years ago
BPO 23808
Nosy @pfmoore, @tjguk, @zware, @serhiy-storchaka, @zooba, @izbyshev
PRs
  • python/cpython#2475
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['type-bug', 'tests', 'OS-windows'] title = 'Symlink to directory on Windows 8' updated_at = user = 'https://github.com/serhiy-storchaka' ``` bugs.python.org fields: ```python activity = actor = 'izbyshev' assignee = 'none' closed = False closed_date = None closer = None components = ['Tests', 'Windows'] creation = creator = 'serhiy.storchaka' dependencies = [] files = [] hgrepos = [] issue_num = 23808 keywords = [] message_count = 5.0 messages = ['239506', '239510', '239514', '261361', '312948'] nosy_count = 7.0 nosy_names = ['paul.moore', 'tim.golden', 'python-dev', 'zach.ware', 'serhiy.storchaka', 'steve.dower', 'izbyshev'] pr_nums = ['2475'] priority = 'normal' resolution = None stage = 'needs patch' status = 'open' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue23808' versions = ['Python 3.4', 'Python 3.5', 'Python 3.6'] ```

    serhiy-storchaka commented 9 years ago

    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', ['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', ['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', ['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')?

    pfmoore commented 9 years ago

    It returns True.

    serhiy-storchaka commented 9 years ago

    Then tests should be adapted for Windows 8.

    1762cc99-3127-4a62-9baf-30c3d0f51ef7 commented 8 years ago

    New changeset 19a3e0e664af by Serhiy Storchaka in branch '3.4': Issues bpo-23808, bpo-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 bpo-23808, bpo-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 bpo-23808, bpo-25911: Trying to fix walk tests on Windows. https://hg.python.org/cpython/rev/da020e408c7f

    9b2dd46a-d3b9-42c4-96ed-ebdd39741ebb commented 6 years ago

    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?