GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pathlib.Path.glob causes OSError encountering symlinks to long filenames · Issue #87695 · python/cpython

pathlib.Path.glob causes OSError encountering symlinks to long filenames #87695

New issue
Copy link
New issue
Copy link
Closed
Closed
pathlib.Path.glob causes OSError encountering symlinks to long filenames#87695
Copy link
Labels
3.10 (EOL)end of lifeend of life3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifetopic-pathlib

Description

ericfrederich
mannequin
opened on Mar 17, 2021
Issue body actions
BPO 43529
Nosy @ericfrederich
Files
  • uhoh.py: Reproduces bug
  • 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 2021-03-17.15:23:36.025>
    labels = ['3.7', '3.8', '3.9', '3.10']
    title = 'pathlib.Path.glob causes OSError encountering symlinks to long filenames'
    updated_at = <Date 2021-03-19.11:28:12.066>
    user = 'https://github.com/ericfrederich'

    bugs.python.org fields:

    activity = <Date 2021-03-19.11:28:12.066>
    actor = 'eric.frederich'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = []
    creation = <Date 2021-03-17.15:23:36.025>
    creator = 'eric.frederich'
    dependencies = []
    files = ['49884']
    hgrepos = []
    issue_num = 43529
    keywords = []
    message_count = 3.0
    messages = ['388927', '388928', '389073']
    nosy_count = 1.0
    nosy_names = ['eric.frederich']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue43529'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

    Linked PRs

    • GH-87695: Fix OSError from pathlib.Path.glob() #104292
    • [3.11] GH-87695: Fix OSError from pathlib.Path.glob() (GH-104292) #104362

    Activity

    1. ericfrederich commented on Mar 17, 2021

      @ericfrederich
      ericfrederichmannequin
      on Mar 17, 2021
      MannequinAuthor
      More actions

      Calling pathlib.Path.glob("**/*) on a directory containing a symlink which resolves to a very long filename causes OSError.

      This is completely avoidable since symlinks are not followed anyway.

      In pathlib.py, the _RecursiveWildcardSelector has a method _iterate_directories which first calls entry.is_dir() prior to excluding based on entry.is_symlink().

      It's the entry.is_dir() which is failing.
      If the check for entry.is_symlink() were to happen first this error would be avoided.

      It's worth noting that on Linux "ls -l bad_link" works fine.
      Also "find /some/path/containing/bad/link" works fine.
      You do get an error however when running "ls bad_link"
      I believe Python's glob() should act like "find" on Linux and not fail.
      Because it is explicitly ignoring symlinks anyway, it has no business calling is_dir() on a symlink.

      I have attached a file which reproduces this problem. It's meant to be ran inside of an empty directory.

    2. ericfrederich
      added
      3.8 (EOL)end of lifeend of life
      3.9 (EOL)end of lifeend of life
      on Mar 17, 2021
    3. ericfrederich commented on Mar 17, 2021

      @ericfrederich
      ericfrederichmannequin
      on Mar 17, 2021
      MannequinAuthor
      More actions

      I verified against all versions available for me to select.
      For 3.10 I used the 3.10-rc Docker image.

    4. ericfrederich
      added
      3.7 (EOL)end of lifeend of life
      3.10 (EOL)end of lifeend of life
      on Mar 17, 2021
    5. ericfrederich commented on Mar 19, 2021

      @ericfrederich
      ericfrederichmannequin
      on Mar 19, 2021
      MannequinAuthor
      More actions

      I'm happy to create a pull request but would need some help.

      Looking at that routine it has changed over time and I cannot simply create a single patch against 3.6 and have it merge cleanly into newer versions.

      I'd need help explaining the process

    6. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    7. serhiy-storchaka
      added this to Fnmatch and glob issueson May 19, 2022
    8. brettcannon
      added
      topic-pathlib
      on Jun 21, 2022
    9. barneygale
      added 4 commits that reference this issue on May 8, 2023

      pythonGH-87695: Fix OSError from `pathlib.Path.glob()`

      e4f3d2b

      pythonGH-87695: Fix OSError from `pathlib.Path.glob()`

      d5f637a

      Merge branch 'main' into pythongh-87695-glob-oserror-long-symlink

      b139e4c

      GH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292)

      a33ce66
    10. miss-islington
      added 2 commits that reference this issue on May 10, 2023

      pythonGH-87695: Fix OSError from `pathlib.Path.glob()` (pythonGH-104292)

      0dd8331

      pythonGH-87695: Fix OSError from `pathlib.Path.glob()` (pythonGH-104292)

      68fde99
    11. carljm
      added a commit that references this issue on May 10, 2023

      Merge branch 'main' into fixloadsuperspec

      5976df9
    12. barneygale
      added a commit that references this issue on May 10, 2023

      [3.11] GH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292) (G…

      846a23d
    13. barneygale commented on May 10, 2023

      @barneygale
      barneygale
      on May 10, 2023
      Contributor
      More actions

      Fixed in 3.12: #104292 / a33ce66

      Backported to 3.11: #104362 / 846a23d

      Reacted by Maurice
    14. barneygale
      closed this as completedon May 10, 2023
    15. github-project-automation
      moved this to Done in Fnmatch and glob issueson May 10, 2023
    16. carljm
      added a commit that references this issue on May 11, 2023

      Merge branch 'main' into supermon

      19b3d9e
    17. encukou commented on May 23, 2023

      @encukou
      encukou
      on May 23, 2023
      Member
      More actions

      Note that this is "fixed" (the error is ignored) in 3.8+ in #79487

    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

      3.10 (EOL)end of lifeend of life3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifetopic-pathlib

      Projects

      • Fnmatch and glob issues
        Status
        Done
        Show more project fields

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.