New submission from Jack Orenstein <[email protected]>:
I am using shlex.quote to pass filenames to a shell command, e.g. ls. The
problem is that glob patterns, when quoted, no longer operate as glob patterns.
So, for example, executing this:
ls 'var/log/syslog*'
results in this output:
ls: cannot access '/var/log/syslog*': No such file or directory
The documentation for shlex.quote says: "Return a shell-escaped version of the
string s. The returned value is a string that can safely be used as one token
in a shell command line, for cases where you cannot use a list."
I believe that quoting needs to preserve glob semantics to fulfill the
documented goal. For example, it seems to me that quoting as follows would be
better:
ls '/var/log/syslog'*
----------
components: Library (Lib)
messages: 367010
nosy: geophile
priority: normal
severity: normal
status: open
title: shlex.quote applied to a glob pattern disables glob matching
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40363>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com