* lisp/files.el (insert-directory): Quote switches in wildcard case.
authorJuri Linkov <juri@linkov.net>
Sun, 7 Jul 2024 06:57:34 +0000 (09:57 +0300)
committerJuri Linkov <juri@linkov.net>
Sun, 7 Jul 2024 06:57:34 +0000 (09:57 +0300)
Use shell-quote-wildcard-pattern on the switches string split by
split-string-and-unquote.  This helps to quote such switches as
"--block-size='1" (bug#71935).

lisp/files.el

index 2fda10fc50edc08cdea9a566cbcf5bbbb28df153..e552f3ac41389902a6a8581a23ff31205ca62cd3 100644 (file)
@@ -8193,9 +8193,15 @@ normally equivalent short `-D' option is just passed on to
                                 "\\") ; Disregard Unix shell aliases!
                               insert-directory-program
                               " -d "
-                              (if (stringp switches)
-                                  switches
-                                (mapconcat #'identity switches " "))
+                              ;; Quote switches that require quoting
+                              ;; such as "--block-size='1".  But don't
+                              ;; quote switches that use patterns
+                              ;; such as "--ignore=PATTERN" (bug#71935).
+                              (mapconcat #'shell-quote-wildcard-pattern
+                                         (if (stringp switches)
+                                             (split-string-and-unquote switches)
+                                           switches)
+                                         " ")
                               " -- "
                               ;; Quote some characters that have
                               ;; special meanings in shells; but