GNU bug report logs - #71935
split-string-and-unquote mishandles dired-listing-switches with '

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Thu, 4 Jul 2024 07:02:01 UTC

Severity: normal

Fixed in version 30.0.60

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71935 <at> debbugs.gnu.org
Subject: bug#71935: split-string-and-unquote mishandles dired-listing-switches with '
Date: Thu, 04 Jul 2024 21:54:02 +0300
>>> 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




This bug report was last modified 320 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.