bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#71935: split-string-and-unquote mishandles dired-listing-switches wi


From: Juri Linkov
Subject: bug#71935: split-string-and-unquote mishandles dired-listing-switches with '
Date: Thu, 04 Jul 2024 21:54:02 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)

>>> 1. (setopt dired-listing-switches "-al --block-size='1")
>>> 2. C-x d /tmp/*
>
> If they are a single string, split it with split-string-and-unquote,
> then concatenate after running each one through shell-quote-argument.
> If they are a list of strings, quote each one before concatenating
> with mapconcat.

Ok, this seems to work:

diff --git a/lisp/files.el b/lisp/files.el
index 042b8e2d515..6ed07f02890 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -8195,9 +8193,11 @@ insert-directory
                                 "\\") ; Disregard Unix shell aliases!
                               insert-directory-program
                               " -d "
-                              (if (stringp switches)
-                                  switches
-                                (mapconcat #'identity switches " "))
+                              (mapconcat #'shell-quote-argument
+                                          (if (stringp switches)
+                                             (split-string-and-unquote 
switches)
+                                            switches)
+                                          " ")
                               " -- "
                               ;; Quote some characters that have
                               ;; special meanings in shells; but





reply via email to

[Prev in Thread] Current Thread [Next in Thread]