X Tutup
The Wayback Machine - https://web.archive.org/web/20260308060357/https://github.com/python/cpython/issues/102503
Skip to content

Inconsistent behavior between os.scandir and os.path for mfsymlinks #102503

@sdawson-nvidia

Description

@sdawson-nvidia

Bug report

With a network drive mounted with CIFS and using the mfsymlinks options, os.path.islink and os.path.isdir will return True for a symbolic link to a directory, whereas the corresponding DirEntry for the symlink will return False for both DirEntry.is_symlink() and DirEntry.is_dir().

Repro steps:

  1. Mount a CIFS drive with -o mfsymlinks to /mnt/scratch
  2. mkdir /mnt/scratch/dir
  3. ln -s /mnt/scratch/dir /mnt/scratch/link
  4. In python 3, run os.scandir('/mnt/scratch') and iterate to the link entry
  5. Validate is_symlink() and is_dir() return False
  6. Run os.path.islink('/mnt/scratch/link') and os.path.isdir('/mnt/scratch/link') and validate both return True

Your environment

Python version 3.8.10, Ubuntu 20.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup