[New-bugs-announce] [issue44380] glob.glob handling of * (asterisk) wildcard is broken

Maxim Egorushkin report at bugs.python.org
Thu Jun 10 11:53:43 EDT 2021


New submission from Maxim Egorushkin <maxim.yegorushkin at gmail.com>:

Problem:

`glob.glob` documentation states that "pathname ... can contain shell-style wildcards." 

However, it stops short of saying that shell-style wildcards are handled the same way as in a POSIX-compliant/friendly shell.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_02 POSIX requires that "`*` (asterisk) is a pattern that shall match any string, including the null string."

However, `glob.glob` pattern `*` (asterisk) doesn't match an empty/null string. 

Reproduction:

$ ls *.bash_profile
.bash_profile
$ python3 -c 'import glob; print(glob.glob("*.bash_profile"))'
[]
$ python3 -c 'import glob; print(glob.glob(".bash_profile"))'
['.bash_profile']

----------
components: Library (Lib)
messages: 395545
nosy: max0x7ba
priority: normal
severity: normal
status: open
title: glob.glob handling of * (asterisk) wildcard is broken
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44380>
_______________________________________


More information about the New-bugs-announce mailing list