Issue 16664: Test Glob: files starting with . (original) (raw)

Created on 2012-12-11 18:25 by Sebastian.Kreft, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python.patch Sebastian.Kreft,2012-12-11 18:25
Messages (8)
msg177345 - (view) Author: Sebastian Kreft (Sebastian.Kreft) * Date: 2012-12-11 18:25
Please find attached a patch to improve the test cases for the glob module. It adds test cases for files starting with '.'.
msg177347 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-11 19:04
See also .
msg177422 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-12-13 17:11
Hm, unix shells have different rules about matching a leading dot or not. Are the docs clear about Python's glob's rules?
msg177428 - (view) Author: Sebastian Kreft (Sebastian.Kreft) * Date: 2012-12-13 18:00
The docs don't say anything about it. However the code is there (docs bug probably). See the following lines in glob.py: 57 if pattern[0] != '.': 58 names = [x for x in names if x[0] != '.'] 59 return fnmatch.filter(names, pattern) The documentation is even harder to follow. The glob docs say: "The pattern may contain simple shell-style wildcards a la fnmatch." but the fnmatch docs say: "Similarly, filenames starting with a period are not special for this module, and are matched by the * and ? patterns." The posix standard states that "if a filename begins with a period ( '.' ), the period shall be explicitly matched" (http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_13_03).
msg177547 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-12-15 18:53
The patch looks good to me. The docs may need improving but that's a separate concern. (also, the current behaviour is reasonable, and there is certainly existing code relying on it)
msg177586 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-12-16 11:35
Patch LGTM and will be applied, I have opened for the related update of the docs. BTW how did you create the patch? The bugtracker/Rietveld didn't recognize it for review and applying it took some effort too.
msg177588 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-12-16 11:49
New changeset 028ecc3900f5 by Hynek Schlawack in branch '2.7': #16664: Add regression tests for glob's behaviour concerning "."-entries http://hg.python.org/cpython/rev/028ecc3900f5 New changeset 29f0c45ce576 by Hynek Schlawack in branch '3.2': #16664: Add regression tests for glob's behaviour concerning "."-entries http://hg.python.org/cpython/rev/29f0c45ce576 New changeset f646842023b3 by Hynek Schlawack in branch '3.3': #16664: Add regression tests for glob's behaviour concerning "."-entries http://hg.python.org/cpython/rev/f646842023b3 New changeset 1fb39efcc3dd by Hynek Schlawack in branch 'default': #16664: Add regression tests for glob's behaviour concerning "."-entries http://hg.python.org/cpython/rev/1fb39efcc3dd
msg177589 - (view) Author: Hynek Schlawack (hynek) * (Python committer) Date: 2012-12-16 11:52
Thank you for your patch and welcome to CPython core development! Presuming you want to submit more patches in future, please take the time to sign a Python contributor agreement: http://www.python.org/psf/contrib/ . You'll get a pretty star next to your name in the bug tracker in return. ;)
History
Date User Action Args
2022-04-11 14:57:39 admin set github: 60868
2012-12-16 11:52:30 hynek set status: open -> closedresolution: fixedmessages: + stage: commit review -> resolved
2012-12-16 11:49:03 python-dev set nosy: + python-devmessages: +
2012-12-16 11:35:24 hynek set type: enhancementmessages: + title: [PATCH] Test Glob: files starting with . -> Test Glob: files starting with .
2012-12-15 18:53:40 pitrou set versions: + Python 2.7, Python 3.2, Python 3.3nosy: + hynek, pitrou, tarekmessages: + stage: commit review
2012-12-13 18:00:15 Sebastian.Kreft set messages: +
2012-12-13 17:11:53 eric.araujo set nosy: + eric.araujomessages: + versions: - Python 3.5
2012-12-11 19:04:11 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2012-12-11 18:25:32 Sebastian.Kreft create