aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2023-09-03 16:13:02 +0200
committerJay Berkenbilt <ejb@ql.org>2023-09-03 16:13:17 +0200
commit3372615e5bc22ed3d4f0f5990ce2e6e41dc06c4f (patch)
treeb75aed5b06c00bd1435239da8bd72696829631b0
parent87765bace9be7d8105b3d148dd389a612299275b (diff)
downloadqpdf-3372615e5bc22ed3d4f0f5990ce2e6e41dc06c4f.tar.zst
Quote program name in completion output (fixes #1021)
-rw-r--r--ChangeLog7
-rw-r--r--libqpdf/QPDFArgParser.cc2
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8362c189..30bf8ff6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
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
compile time. Since, by default, the crypto provider provides
random numbers, runtime determinination of a random number device
diff --git a/libqpdf/QPDFArgParser.cc b/libqpdf/QPDFArgParser.cc
index 3ebec29c..5377b2bc 100644
--- a/libqpdf/QPDFArgParser.cc
+++ b/libqpdf/QPDFArgParser.cc
@@ -193,7 +193,7 @@ QPDFArgParser::completionCommon(bool zsh)
if (!zsh) {
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
std::string path = progname;
size_t slash = path.find('/');