Commit 3372615e5bc22ed3d4f0f5990ce2e6e41dc06c4f

Authored by Jay Berkenbilt
1 parent 87765bac

Quote program name in completion output (fixes #1021)

ChangeLog
1 2023-09-03 Jay Berkenbilt <ejb@ql.org> 1 2023-09-03 Jay Berkenbilt <ejb@ql.org>
2 2
  3 + * Put quotation marks around the command in completion output to
  4 + better handle spaces in paths. It is not a perfect fix (ideally,
  5 + full shell-compatible quoting should be used), but it handles more
  6 + cases than the old code and should handle all reasonable cases of
  7 + qpdf being in a directory with a space in its name, which is
  8 + common in Windows. Fixes #1021.
  9 +
3 * Move check for random number device to runtime instead of 10 * Move check for random number device to runtime instead of
4 compile time. Since, by default, the crypto provider provides 11 compile time. Since, by default, the crypto provider provides
5 random numbers, runtime determinination of a random number device 12 random numbers, runtime determinination of a random number device
libqpdf/QPDFArgParser.cc
@@ -193,7 +193,7 @@ QPDFArgParser::completionCommon(bool zsh) @@ -193,7 +193,7 @@ QPDFArgParser::completionCommon(bool zsh)
193 if (!zsh) { 193 if (!zsh) {
194 std::cout << " -o nospace"; 194 std::cout << " -o nospace";
195 } 195 }
196 - std::cout << " -C " << progname << " " << m->whoami << std::endl; 196 + std::cout << " -C \"" << progname << "\" " << m->whoami << std::endl;
197 // Put output before error so calling from zsh works properly 197 // Put output before error so calling from zsh works properly
198 std::string path = progname; 198 std::string path = progname;
199 size_t slash = path.find('/'); 199 size_t slash = path.find('/');