]> git.eshelyaron.com Git - emacs.git/commitdiff
Quote file names in dired compression commands
authorJosé L. Doménech <domenechjosel@gmail.com>
Sun, 30 Oct 2016 01:18:31 +0000 (21:18 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Sun, 30 Oct 2016 01:32:11 +0000 (21:32 -0400)
* 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

index d25352ec5bcc8ae3adbd2d3f62589b779283201e..972b6b1ade0247e5e106a378abfa49ae9647f75f 100644 (file)
@@ -1012,11 +1012,13 @@ and `dired-compress-files-alist'."
           (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)))))))