-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive '**' matches non-existent directories. #79382
Comments
In the following case, when there is no file or directory 'a', glob will still return it: >>> glob.glob("a/**", recursive=True)
[ 'a/' ] Note that this is inconsistent with the '*' pattern: >>> glob.glob("a/*", recursive=True)
[] |
This is expected behavior, and it matches the behavior of Bash. $ mkdir empty
$ shopt -s globstar failglob
$ echo empty/*
bash: no match: empty/*
$ echo empty/**
empty/ "**" matches zero or more path components. In this case case it matches zero. |
In the Bash example, you created the directory empty/. This bug is specifically when the directory in question does not exist. |
Similar issue with existing file returned as directory: $ touch file
$ shopt -s globstar failglob
$ echo file/*
-bash: no match: file/*
$ echo file/**
-bash: no match: file/** >>> glob.glob('file/*', recursive=True)
[]
>>> glob.glob('file/**', recursive=True)
['file/'] |
Trailing "**" no longer allows to match files and non-existing paths in recursive glob().
Trailing "**" no longer allows to match files and non-existing paths in recursive glob().
) Trailing "**" no longer allows to match files and non-existing paths in recursive glob(). (cherry picked from commit aeffc7f) Co-authored-by: Serhiy Storchaka <[email protected]>
) Trailing "**" no longer allows to match files and non-existing paths in recursive glob(). (cherry picked from commit aeffc7f) Co-authored-by: Serhiy Storchaka <[email protected]>
…H-115290) Trailing "**" no longer allows to match files and non-existing paths in recursive glob(). (cherry picked from commit aeffc7f) Co-authored-by: Serhiy Storchaka <[email protected]>
…H-115291) Trailing "**" no longer allows to match files and non-existing paths in recursive glob(). (cherry picked from commit aeffc7f) Co-authored-by: Serhiy Storchaka <[email protected]>
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:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: