Subject: Re: bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters

From: [email-masked]
Date: Sat, 29 Oct 2016 21:39:01 -0400

tags 24620 fixed
close 24620 26
quit

José L. Doménech <[email-masked]> writes:
> Sorry for the delay.

I don't worry about delays which are approximately 0 days long :)

> Perhaps this is more convenient:
>
> 2016-09-29  José L. Doménech  <[email-masked]>
>
> Fix bug#24620: In dired enable compress to/from files whose filenames contains space characters.

Okay, now the summary line is a bit too long.  I shortened the summary
and pushed your patch to master.

>From 27443df092bfb4ada559f8fc024e01f174a5bcb0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Dom=C3=A9nech?= <[email-masked]>
Date: Sat, 29 Oct 2016 21:18:31 -0400
Subject: [PATCH] Quote file names in dired compression commands

* lisp/dired-aux.el (dired-do-compress-to): Change the string
used as shell command for compression by quoting the filenames
used for input and output (Bug #24620).
---
 lisp/dired-aux.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index d25352e..972b6b1 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1012,11 +1012,13 @@ dired-do-compress-to
           (t
            (when (zerop
                   (dired-shell-command
-                   (replace-regexp-in-string
-                    "%o" out-file
-                    (replace-regexp-in-string
-                     "%i" (mapconcat #'file-name-nondirectory in-files " ")
-                     (cdr rule)))))
+                   (format-spec (cdr rule)
+                                `((?\o . ,(shell-quote-argument out-file))
+                                  (?\i . ,(mapconcat
+                                           (lambda (file-desc)
+                                             (shell-quote-argument (file-name-nondirectory
+                                                                    file-desc)))
+                                           in-files " "))))))
              (message "Compressed %d file(s) to %s"
                       (length in-files)
                       (file-name-nondirectory out-file)))))))
-- 
2.9.3

>
> Thanks for your patiente.

Thanks for your contribution.

P.S. your mails seem to be getting duplicated (or even triplicated for the
last one).