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 directory
decibel@decina:[14:07]~$ls ~/tmp/d*/base/1|head
112

>From a posix standpoint, this would easily be fixed by using '[^/]*' instead 
>of '.*'. I'm not sure how to make this work cross-platform though.

It's worth noting that some programs (rsync, git) support **, which would 
correctly translate to '.*'.

----------
components: Library (Lib)
messages: 280985
nosy: Jim Nasby
priority: normal
severity: normal
status: open
title: '*' matches entire path in fnmatch.translate

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28718>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to