[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Maxim Egorushkin


Maxim Egorushkin  added the comment:

> glob.glob does not provide something equivalent to a DOTALL flag 

I see now, said a blind man.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Isaac Muse


Isaac Muse  added the comment:

Sadly, this because pathlib glob and glob.glob use different implementations. 
And glob.glob does not provide something equivalent to a DOTALL flag allowing a 
user to glob hidden files without explicitly defining the leading dot in the 
pattern.

--
nosy: +Isaac Muse

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Maxim Egorushkin


Maxim Egorushkin  added the comment:

I may be naive, but why then:

$ python3 -c 'from pathlib import Path; 
print(list(Path(".").glob("*.bash_profile")))'

Outputs:

[PosixPath('.bash_profile')]


?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +nailor, petri.lehtinen

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Only pattern beginning with a dot can match filename beginning with a dot.

>From https://docs.python.org/3/library/glob.html

   Note that unlike fnmatch.fnmatch(), glob treats filenames beginning with a 
dot (.) as special cases.

This phrase was added in issue16695 in attempt to improve documentation, but it 
is still not clear.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python, serhiy.storchaka
type: behavior -> enhancement
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Maxim Egorushkin


Change by Maxim Egorushkin :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Maxim Egorushkin


New submission from Maxim Egorushkin :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com