Skip to content

dangling symlinks cause crash #22

@wimglenn

Description

@wimglenn

When using PathSpec.match_tree, If there is a broken symlink encountered, we get unhandled exception. It's here:

https://github.com/cpburnz/python-path-specification/blob/da86e2c4d557df2d0a7cc9743268a7173d3a4828/pathspec/util.py#L68

I think you could fix it with os.lstat instead, but that's backwards incompat change.

Perhaps iter_tree could have an option to not follow symlinks? You could follow the example of os.walk, which accepts a followlinks keyword arg, and also an onerror callback which can be used to handle problems such as permission errors when stat each file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions