Skip to content

Symlink to directory on Windows 8 #67996

Closed as not planned
Closed as not planned

Description

@serhiy-storchaka
BPO 23808
Nosy @pfmoore, @tjguk, @zware, @serhiy-storchaka, @zooba, @izbyshev
PRs
  • [3.4] Backport CI config from master #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:

    assignee = None
    closed_at = None
    created_at = <Date 2015-03-29.18:45:10.431>
    labels = ['type-bug', 'tests', 'OS-windows']
    title = 'Symlink to directory on Windows 8'
    updated_at = <Date 2018-02-26.20:20:15.918>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-02-26.20:20:15.918>
    actor = 'izbyshev'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests', 'Windows']
    creation = <Date 2015-03-29.18:45:10.431>
    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']

    Activity

    1. serhiy-storchaka commented on Mar 29, 2015

      @serhiy-storchaka
      MemberAuthor

      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 &#34;D:\buildarea\3.4.bolen-windows8\build\lib\test\test_os.py&#34;, line 802, in test_walk_bottom_up
          self.sub2_tree)
      AssertionError: Tuples differ: (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;broken_link&#39;, &#39;link&#39;], [&#39;tmp3&#39;]) != (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;link&#39;], [&#39;broken_link&#39;, &#39;tmp3&#39;])
      
      First differing element 1:
      [&#39;broken_link&#39;, &#39;link&#39;]
      [&#39;link&#39;]
      
      - (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;broken_link&#39;, &#39;link&#39;], [&#39;tmp3&#39;])
      ?                                                 ----------
      
      + (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;link&#39;], [&#39;broken_link&#39;, &#39;tmp3&#39;])
      ?                                 ++++++++++
      
      
      ======================================================================
      FAIL: test_walk_prune (test.test_os.WalkTests)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File &#34;D:\buildarea\3.4.bolen-windows8\build\lib\test\test_os.py&#34;, line 782, in test_walk_prune
          self.assertEqual(all[1], self.sub2_tree)
      AssertionError: Tuples differ: (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;broken_link&#39;, &#39;link&#39;], [&#39;tmp3&#39;]) != (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;link&#39;], [&#39;broken_link&#39;, &#39;tmp3&#39;])
      
      First differing element 1:
      [&#39;broken_link&#39;, &#39;link&#39;]
      [&#39;link&#39;]
      
      - (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;broken_link&#39;, &#39;link&#39;], [&#39;tmp3&#39;])
      ?                                                 ----------
      
      + (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;link&#39;], [&#39;broken_link&#39;, &#39;tmp3&#39;])
      ?                                 ++++++++++
      
      
      ======================================================================
      FAIL: test_walk_topdown (test.test_os.WalkTests)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File &#34;D:\buildarea\3.4.bolen-windows8\build\lib\test\test_os.py&#34;, line 765, in test_walk_topdown
          self.assertEqual(all[3 - 2 * flipped], self.sub2_tree)
      AssertionError: Tuples differ: (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;broken_link&#39;, &#39;link&#39;], [&#39;tmp3&#39;]) != (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;link&#39;], [&#39;broken_link&#39;, &#39;tmp3&#39;])
      
      First differing element 1:
      [&#39;broken_link&#39;, &#39;link&#39;]
      [&#39;link&#39;]
      
      - (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;broken_link&#39;, &#39;link&#39;], [&#39;tmp3&#39;])
      ?                                                 ----------
      
      + (&#39;@test_3872_tmp\\TEST1\\SUB2&#39;, [&#39;link&#39;], [&#39;broken_link&#39;, &#39;tmp3&#39;])
      ?                                 ++++++++++
      
      
      ----------------------------------------------------------------------
      

      Create broken link:

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

      What return os.path.isdir('broken_link')?

    2. pfmoore commented on Mar 29, 2015

      @pfmoore
      Member

      It returns True.

    3. serhiy-storchaka commented on Mar 29, 2015

      @serhiy-storchaka
      MemberAuthor

      Then tests should be adapted for Windows 8.

    4. python-dev commented on Mar 8, 2016

      python-devmannequin
      Mannequin

      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

    5. izbyshev commented on Feb 26, 2018

      izbyshevmannequin
      Mannequin

      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?

    6. transferred this issue fromon Apr 10, 2022
    7. serhiy-storchaka commented on Aug 5, 2026

      @serhiy-storchaka
      MemberAuthor

      Cannot be reproduced with current code on Windows 11. Windows 8 is a far past.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      OS-windowstestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions