Subject: split-string-and-unquote mishandles dired-listing-switches with '

From: Juri Linkov <[email-masked]>
Date: Thu, 04 Jul 2024 09:51:10 +0300

0. emacs -Q
1. (setopt dired-listing-switches "-al --block-size='1")
2. C-x d /tmp/*

  /tmp:
  wildcard *
  /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
  /bin/bash: -c: line 1: syntax error: unexpected end of file

3. (setopt dired-listing-switches "-al --block-size=\\'1")
4. C-x d /tmp/

Debugger entered--Lisp error: (error "Listing directory failed but ‘access-file’ worked")
  error("Listing directory failed but `access-file' worked")
  insert-directory("/tmp/" "--dired -N -al --block-size=\\'1" nil t)
  dired-insert-directory("/tmp/" "-al --block-size=\\'1" nil nil t)
  dired-readin-insert()
  dired-readin()
  dired-internal-noselect("/tmp/" nil)
  dired-noselect("/tmp/" nil)
  dired("/tmp/" nil)
  funcall-interactively(dired "/tmp/" nil)
  command-execute(dired)

because 'split-string-and-unquote' in 'insert-directory'
doesn't turn "--block-size=\\'1" into "--block-size='1".

5. (setopt dired-listing-switches "-al --block-size=\"'1\"")
6. C-x d /tmp/

Same error for another reason, because 'split-string-and-unquote'
splits "--block-size=\"'1\"" to '("--block-size=" "'1").