changeset 32284:265930c2158b

mkoctfile: Attempt to quote any replaced prefix parts (bug #64609). * src/mkoctfile.in.cc (replace_prefix): Quote prefix replacement if it is not already quoted and contains a space.
author John Donoghue <john.donoghue@ieee.org>
date Tue, 29 Aug 2023 20:20:25 -0400
parents d668c52cf2e6
children d2540b8c9fdd
files src/mkoctfile.in.cc
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/mkoctfile.in.cc	Sun Aug 27 16:29:40 2023 +0200
+++ b/src/mkoctfile.in.cc	Tue Aug 29 20:20:25 2023 -0400
@@ -164,7 +164,11 @@
   std::size_t pos = s.find (match);
   while (pos != std::string::npos )
     {
-      s.replace (pos, match.length (), repl);
+      // Quote replacement path if the input isn't quoted.
+      if (pos > 0 && s[pos-1] != '"' && s[pos-1] != '\'')
+        s.replace (pos, match.length (), quote_path (repl));
+      else
+        s.replace (pos, match.length (), repl);
       pos = s.find (match);
     }
 #endif