GNU bug report logs -
#63142
30.0.50; QUOTING_STYLE can break dired
Previous Next
Reported by: Yuri D'Elia <wavexx <at> thregr.org>
Date: Fri, 28 Apr 2023 09:47:02 UTC
Severity: normal
Found in version 30.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #26 received at 63142 <at> debbugs.gnu.org (full text, mbox):
> From: Yuri D'Elia <wavexx <at> thregr.org>
> Cc: 63142 <at> debbugs.gnu.org
> Date: Fri, 28 Apr 2023 20:01:01 +0200
>
> So searching through coreutils I find this old report:
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23024
>
> | On further analysis I see that --dired mode already distinguishes
> | the quoting-style in its output. Also we had already documented
> | that --dired should specify a --quoting-style to get consistent output.
>
> Which huh, does mention this in the ls manual:
>
> | If you use a quoting style like ‘--quoting-style=c’ (‘-Q’) that
> | adds quote marks, then the offsets include the quote marks. So
> | beware that the user may select the quoting style via the
> | environment variable ‘QUOTING_STYLE’. Hence, applications using
> | ‘--dired’ should either specify an explicit
> | ‘--quoting-style=literal’ (‘-N’) option on the command line, or
> | else be prepared to parse the escaped names.
>
> Then it references a commit mentioning an emacs fix:
>
> https://github.com/emacs-mirror/emacs/commit/e4adb6
>
> which however seems to apply to tramp only.
Does the patch below give good results?
diff --git a/lisp/dired.el b/lisp/dired.el
index d1471e9..e3a9d7b 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1653,7 +1653,10 @@ dired-insert-directory
see `dired-use-ls-dired' for more details.")
nil))
dired-use-ls-dired)))
- (setq switches (concat "--dired " switches)))
+ ;; Use -N with --dired, to countermand possible non-default
+ ;; quoting style, in particular via the environment variable
+ ;; QUOTINTG_STYLE.
+ (setq switches (concat "--dired -N " switches)))
;; Expand directory wildcards and fill file-list.
(let ((dir-wildcard (insert-directory-wildcard-in-dir-p dir)))
(cond (dir-wildcard
This bug report was last modified 2 years and 18 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.