From 6c257f8043b699f7e8d881d57a715c3d41ebd5ac Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 7 Jul 2024 09:57:34 +0300 Subject: [PATCH] * lisp/files.el (insert-directory): Quote switches in wildcard case. 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). (cherry picked from commit b249f022f1285aaf02705b6ac239d95e3b413c18) --- lisp/files.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index ab2b0223d1d..33216018194 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -8240,9 +8240,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 -- 2.39.2