This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author geophile
Recipients geophile
Date 2020-04-22.15:21:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587568891.1.0.0837751696044.issue40363@roundup.psfhosted.org>
In-reply-to
Content
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'*
History
Date User Action Args
2020-04-22 15:21:31geophilesetrecipients: + geophile
2020-04-22 15:21:31geophilesetmessageid: <1587568891.1.0.0837751696044.issue40363@roundup.psfhosted.org>
2020-04-22 15:21:30geophilelinkissue40363 messages
2020-04-22 15:21:30geophilecreate