[issue28718] '*' matches entire path in fnmatch.translate

2016-11-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Oops, altsep is None, not the empty string when there is only one separator. And I didn't handle inverting the match. Sigh. You get the idea. -- ___ Python tracker ___

[issue28718] '*' matches entire path in fnmatch.translate

2016-11-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Presumably something like: r'(?:' + r'|'.join({re.escape(os.path.sep), re.escape(os.path.altsep)}) + r')' would cover it completely. I switched to using non-capturing groups over a character class both to deal with the fact that escaping doesn't work the same

[issue28718] '*' matches entire path in fnmatch.translate

2016-11-16 Thread Jim Nasby
New submission from Jim Nasby: A '*' in fnmatch.translate is converted into '.*', which will greedily match directory separators. This doesn't match shell behavior, which is that * will only match file names: decibel@decina:[14:07]~$ls ~/tmp/*/1|head ls: /Users/decibel/tmp/*/1: No such file or