Quote program name in completion output (fixes #1021)

This commit is contained in:
Jay Berkenbilt 2023-09-03 10:13:02 -04:00
parent 87765bace9
commit 3372615e5b
2 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,12 @@
2023-09-03 Jay Berkenbilt <ejb@ql.org> 2023-09-03 Jay Berkenbilt <ejb@ql.org>
* Put quotation marks around the command in completion output to
better handle spaces in paths. It is not a perfect fix (ideally,
full shell-compatible quoting should be used), but it handles more
cases than the old code and should handle all reasonable cases of
qpdf being in a directory with a space in its name, which is
common in Windows. Fixes #1021.
* Move check for random number device to runtime instead of * Move check for random number device to runtime instead of
compile time. Since, by default, the crypto provider provides compile time. Since, by default, the crypto provider provides
random numbers, runtime determinination of a random number device random numbers, runtime determinination of a random number device

View File

@ -193,7 +193,7 @@ QPDFArgParser::completionCommon(bool zsh)
if (!zsh) { if (!zsh) {
std::cout << " -o nospace"; std::cout << " -o nospace";
} }
std::cout << " -C " << progname << " " << m->whoami << std::endl; std::cout << " -C \"" << progname << "\" " << m->whoami << std::endl;
// Put output before error so calling from zsh works properly // Put output before error so calling from zsh works properly
std::string path = progname; std::string path = progname;
size_t slash = path.find('/'); size_t slash = path.find('/');