Message367010
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'* |
|
Date |
User |
Action |
Args |
2020-04-22 15:21:31 | geophile | set | recipients:
+ geophile |
2020-04-22 15:21:31 | geophile | set | messageid: <1587568891.1.0.0837751696044.issue40363@roundup.psfhosted.org> |
2020-04-22 15:21:30 | geophile | link | issue40363 messages |
2020-04-22 15:21:30 | geophile | create | |
|