Subject: Re: bug#71935: split-string-and-unquote mishandles dired-listing-switches with '

From: Eli Zaretskii <[email-masked]>
Date: Thu, 04 Jul 2024 22:11:27 +0300

> Cc: [email-masked]
> Date: Thu, 04 Jul 2024 22:03:00 +0300
> From: Eli Zaretskii <[email-masked]>
> 
> > 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
> > 
> 
> Thanks, that's what I had in mind.  Please install on the emacs-30
> branch.

On second thought: could there be options that include shell
wildcards, which therefore should not be quoted?  If so, perhaps
instead of shell-quote-argument we should use
shell-quote-wildcard-pattern?