unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
@ 2016-10-05  7:06 José L. Doménech
  2016-10-27 14:03 ` José L. Doménech
  0 siblings, 1 reply; 19+ messages in thread
From: José L. Doménech @ 2016-10-05  7:06 UTC (permalink / raw)
  To: 24620


1) C-x d      ;; Open a directory in dired mode

2)            ;; Mark any file/s whose filenames contains space
characters

3) c          ;; run dired-do-compress-to

4) kk.tar.gz  ;; Enter a name for the file output (the output type
seems irrelevant)

5) g          ;; refresh dired

Check that a 45 bytes size file has been created. Note that it is not a
valid compressed file ;).

Thankful for your amazing work:

José L. Doménech


In GNU Emacs 26.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 2.24.30)
 of 2016-10-03 built on jose-ThinkPad-Edge-E330
Repository revision: 8cd975cebd588d5435fa2b333dba6c526e602933
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description:	Linux Mint 18 Sarah

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Compressed 1 file(s) to rsefsosf.webm.tar.gz

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY
GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK2 X11

Important settings:
  value of $LANG: es_ES.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cl-extra help-mode cconv format-spec rfc822 mml
easymenu mml-sec password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils cl-seq dired-aux cl-loaddefs pcase cl-lib
dired dired-loaddefs time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 101053 10054)
 (symbols 48 20412 0)
 (miscs 40 44 136)
 (strings 32 17874 3826)
 (string-bytes 1 567807)
 (vectors 16 13601)
 (vector-slots 8 448903 4223)
 (floats 8 184 163)
 (intervals 56 281 0)
 (buffers 976 13)
 (heap 1024 20269 1028))





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-05  7:06 bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters José L. Doménech
@ 2016-10-27 14:03 ` José L. Doménech
  2016-10-27 17:19   ` Eli Zaretskii
  2016-10-27 17:34   ` Michael Albinus
  0 siblings, 2 replies; 19+ messages in thread
From: José L. Doménech @ 2016-10-27 14:03 UTC (permalink / raw)
  To: 24620

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

I wrote a little patch to get a workaround around dired having some trouble compressing files with space characters in its name (bug #24620).

I am not sure if this will useful to someone. Please NOTE that I am using apostrophes to surround the file name's. While it works on my system (GNU/Linux) it could not work on other systems.

Best Regards:
José L. Doménech


[-- Attachment #2: dired-aux.el.patch --]
[-- Type: text/plain, Size: 1434 bytes --]

diff -u dired-aux.el dired-aux-mod.el
--- dired-aux.el	2016-10-27 15:50:50.428634418 +0200
+++ dired-aux-mod.el	2016-10-27 15:49:07.075635431 +0200
@@ -974,10 +974,10 @@
 ARGS are command switches passed to PROGRAM.")
 
 (defvar dired-compress-files-alist
-  '(("\\.tar\\.gz\\'" . "tar -c %i | gzip -c9 > %o")
-    ("\\.tar\\.bz2\\'" . "tar -c %i | bzip2 -c9 > %o")
-    ("\\.tar\\.xz\\'" . "tar -c %i | xz -c9 > %o")
-    ("\\.zip\\'" . "zip %o -r --filesync %i"))
+  '(("\\.tar\\.gz\\'" . "tar -c %i | gzip -c9 > '%o'")
+    ("\\.tar\\.bz2\\'" . "tar -c %i | bzip2 -c9 > '%o'")
+    ("\\.tar\\.xz\\'" . "tar -c %i | xz -c9 > '%o'")
+    ("\\.zip\\'" . "zip '%o' -r --filesync %i"))
   "Control the compression shell command for `dired-do-compress-to'.
 
 Each element is (REGEXP . CMD), where REGEXP is the name of the
@@ -1015,7 +1015,9 @@
                    (replace-regexp-in-string
                     "%o" out-file
                     (replace-regexp-in-string
-                     "%i" (mapconcat #'file-name-nondirectory in-files " ")
+                     "%i" (mapconcat (lambda (file-desc)
+                                       (concat "'"
+                                               (file-name-nondirectory file-desc) "'")) in-files " ")
                      (cdr rule)))))
              (message "Compressed %d file(s) to %s"
                       (length in-files)

Diff finished.  Thu Oct 27 15:53:44 2016

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-27 14:03 ` José L. Doménech
@ 2016-10-27 17:19   ` Eli Zaretskii
  2016-10-27 17:34   ` Michael Albinus
  1 sibling, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2016-10-27 17:19 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620

> Date: Thu, 27 Oct 2016 16:03:47 +0200
> From: José L. Doménech
> 	<domenechjosel@gmail.com>
> 
> I wrote a little patch to get a workaround around dired having some trouble compressing files with space characters in its name (bug #24620).

Thanks.

> I am not sure if this will useful to someone. Please NOTE that I am using apostrophes to surround the file name's. While it works on my system (GNU/Linux) it could not work on other systems.

I suggest to use shell-quote-argument for that, because that function
already supports all the systems where Emacs can be built.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-27 14:03 ` José L. Doménech
  2016-10-27 17:19   ` Eli Zaretskii
@ 2016-10-27 17:34   ` Michael Albinus
  2016-10-27 18:39     ` José L. Doménech
  1 sibling, 1 reply; 19+ messages in thread
From: Michael Albinus @ 2016-10-27 17:34 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620

José L. Doménech <domenechjosel@gmail.com> writes:

Hi José,

> I wrote a little patch to get a workaround around dired having some
> trouble compressing files with space characters in its name (bug
> #24620).

Thanks for this!

> I am not sure if this will useful to someone. Please NOTE that I am
> using apostrophes to surround the file name's. While it works on my
> system (GNU/Linux) it could not work on other systems.

I believe it is better not to touch `dired-compress-files-alist'. Instead,
at places where "%i and %o are replaced, one shall call
`shell-quote-argument', as it is applied already in `dired-compress-file'.

> Best Regards:
> José L. Doménech

Best regards, Michael.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-27 17:34   ` Michael Albinus
@ 2016-10-27 18:39     ` José L. Doménech
  2016-10-27 18:51       ` Noam Postavsky
  0 siblings, 1 reply; 19+ messages in thread
From: José L. Doménech @ 2016-10-27 18:39 UTC (permalink / raw)
  To: Michael Albinus, Eli Zaretskii; +Cc: 24620, José L. Doménech

On Thu, 27 Oct 2016 19:34:49 +0200,
Michael Albinus wrote:
> 
> José L. Doménech <domenechjosel@gmail.com> writes:
> 
> Hi José,
> 
> > I wrote a little patch to get a workaround around dired having some
> > trouble compressing files with space characters in its name (bug
> > #24620).
> 
> Thanks for this!
> 
> > I am not sure if this will useful to someone. Please NOTE that I am
> > using apostrophes to surround the file name's. While it works on my
> > system (GNU/Linux) it could not work on other systems.
> 
> I believe it is better not to touch `dired-compress-files-alist'. Instead,
> at places where "%i and %o are replaced, one shall call
> `shell-quote-argument', as it is applied already in `dired-compress-file'.
>

I am getting a "replace-regexp-in-string: Invalid use of ‘\’ in replacement text"
error using 'shell-quote-argument' on this case.

It seems that 'shell-quoted-argument' is adding double '\', that is,
'\\', in front of the spaces instead of surrounding the argument with quotes.

And 'replace-match' which is called by 'replace-regexp-in-string' for the parameter
substitution ("%i", "%o") in the function 'dired-do-compress-to' doesn't like it.
  
> > Best Regards:
> > José L. Doménech
> 
> Best regards, Michael.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-27 18:39     ` José L. Doménech
@ 2016-10-27 18:51       ` Noam Postavsky
  2016-10-27 19:29         ` José L. Doménech
  2016-10-27 19:31         ` José L. Doménech
  0 siblings, 2 replies; 19+ messages in thread
From: Noam Postavsky @ 2016-10-27 18:51 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

On Thu, Oct 27, 2016 at 2:39 PM, José L. Doménech
<domenechjosel@gmail.com> wrote:
> I am getting a "replace-regexp-in-string: Invalid use of ‘\’ in replacement text"
> error using 'shell-quote-argument' on this case.
>
> It seems that 'shell-quoted-argument' is adding double '\', that is,
> '\\', in front of the spaces instead of surrounding the argument with quotes.
>
> And 'replace-match' which is called by 'replace-regexp-in-string' for the parameter
> substitution ("%i", "%o") in the function 'dired-do-compress-to' doesn't like it.

Does passing non-nil for the LITERAL parameter to replace-regexp-in-string help?





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-27 18:51       ` Noam Postavsky
@ 2016-10-27 19:29         ` José L. Doménech
  2016-10-27 23:14           ` npostavs
  2016-10-27 19:31         ` José L. Doménech
  1 sibling, 1 reply; 19+ messages in thread
From: José L. Doménech @ 2016-10-27 19:29 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

[-- Attachment #1: Type: text/plain, Size: 788 bytes --]

On Thu, 27 Oct 2016 20:51:15 +0200,
Noam Postavsky wrote:
> 
> On Thu, Oct 27, 2016 at 2:39 PM, José L. Doménech
> <domenechjosel@gmail.com> wrote:
> > I am getting a "replace-regexp-in-string: Invalid use of ‘\’ in replacement text"
> > error using 'shell-quote-argument' on this case.
> >
> > It seems that 'shell-quoted-argument' is adding double '\', that is,
> > '\\', in front of the spaces instead of surrounding the argument with quotes.
> >
> > And 'replace-match' which is called by 'replace-regexp-in-string' for the parameter
> > substitution ("%i", "%o") in the function 'dired-do-compress-to' doesn't like it.
> 
> Does passing non-nil for the LITERAL parameter to replace-regexp-in-string help?
> 
Yes indeed!

So the patch becomes something like:


[-- Attachment #2: dired-aux.el.patch --]
[-- Type: text/plain, Size: 1181 bytes --]

diff -u /usr/local/share/emacs/26.0.50/lisp/dired-aux.orig.el /usr/local/share/emacs/26.0.50/lisp/dired-aux.el
--- /usr/local/share/emacs/26.0.50/lisp/dired-aux.orig.el	2016-10-27 15:50:50.428634418 +0200
+++ /usr/local/share/emacs/26.0.50/lisp/dired-aux.el	2016-10-27 21:24:29.022566630 +0200
@@ -1013,10 +1013,13 @@
            (when (zerop
                   (dired-shell-command
                    (replace-regexp-in-string
-                    "%o" out-file
+                    "%o" (shell-quote-argument out-file)
                     (replace-regexp-in-string
-                     "%i" (mapconcat #'file-name-nondirectory in-files " ")
-                     (cdr rule)))))
+                     "%i" (mapconcat (lambda (file-desc)
+                                       (shell-quote-argument
+                                        (file-name-nondirectory file-desc)))
+                                     in-files " ")
+                     (cdr rule) nil t) nil t)))
              (message "Compressed %d file(s) to %s"
                       (length in-files)
                       (file-name-nondirectory out-file)))))))

Diff finished.  Thu Oct 27 21:24:43 2016

^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-27 18:51       ` Noam Postavsky
  2016-10-27 19:29         ` José L. Doménech
@ 2016-10-27 19:31         ` José L. Doménech
  1 sibling, 0 replies; 19+ messages in thread
From: José L. Doménech @ 2016-10-27 19:31 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

On Thu, 27 Oct 2016 20:51:15 +0200,
Noam Postavsky wrote:
>  
> Does passing non-nil for the LITERAL parameter to replace-regexp-in-string help?
> 
Yes indeed!

So the patch becomes something like:

diff -u /usr/local/share/emacs/26.0.50/lisp/dired-aux.orig.el /usr/local/share/emacs/26.0.50/lisp/dired-aux.el
--- /usr/local/share/emacs/26.0.50/lisp/dired-aux.orig.el	2016-10-27 15:50:50.428634418 +0200
+++ /usr/local/share/emacs/26.0.50/lisp/dired-aux.el	2016-10-27 21:24:29.022566630 +0200
@@ -1013,10 +1013,13 @@
            (when (zerop
                   (dired-shell-command
                    (replace-regexp-in-string
-                    "%o" out-file
+                    "%o" (shell-quote-argument out-file)
                     (replace-regexp-in-string
-                     "%i" (mapconcat #'file-name-nondirectory in-files " ")
-                     (cdr rule)))))
+                     "%i" (mapconcat (lambda (file-desc)
+                                       (shell-quote-argument
+                                        (file-name-nondirectory file-desc)))
+                                     in-files " ")
+                     (cdr rule) nil t) nil t)))
              (message "Compressed %d file(s) to %s"
                       (length in-files)
                       (file-name-nondirectory out-file)))))))

Diff finished.  Thu Oct 27 21:24:43 2016





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-27 19:29         ` José L. Doménech
@ 2016-10-27 23:14           ` npostavs
  2016-10-28  7:06             ` José L. Doménech
  2016-10-28  9:22             ` bug#24620: Forward: " José L. Doménech
  0 siblings, 2 replies; 19+ messages in thread
From: npostavs @ 2016-10-27 23:14 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

José L. Doménech <domenechjosel@gmail.com> writes:
>
> So the patch becomes something like:
>
>                    (dired-shell-command
>                     (replace-regexp-in-string
> -                    "%o" out-file
> +                    "%o" (shell-quote-argument out-file)
>                      (replace-regexp-in-string
> -                     "%i" (mapconcat #'file-name-nondirectory in-files " ")
> -                     (cdr rule)))))
> +                     "%i" (mapconcat (lambda (file-desc)
> +                                       (shell-quote-argument
> +                                        (file-name-nondirectory file-desc)))
> +                                     in-files " ")
> +                     (cdr rule) nil t) nil t)))

That looks pretty good.  I think it would be even nicer to use the
`format-spec' function instead of calling `replace-regexp-in-string'
twice.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-27 23:14           ` npostavs
@ 2016-10-28  7:06             ` José L. Doménech
  2016-10-29  2:06               ` npostavs
  2016-10-28  9:22             ` bug#24620: Forward: " José L. Doménech
  1 sibling, 1 reply; 19+ messages in thread
From: José L. Doménech @ 2016-10-28  7:06 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

On Fri, 28 Oct 2016 01:14:49 +0200,
npostavs@users.sourceforge.net wrote:
> 
> 
> That looks pretty good.  I think it would be even nicer to use the
> `format-spec' function instead of calling `replace-regexp-in-string'
> twice.
> 
> 
Here are the changes:

--- dired-aux.orig.el	2016-10-27 15:50:50.428634418 +0200
+++ dired-aux.el	2016-10-28 09:01:08.413024427 +0200
@@ -1012,11 +1012,15 @@
           (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)
+                    (list (cons ?o (shell-quote-argument out-file))
+                          (cons ?i
+                                (mapconcat
+                                 (lambda (filename)
+                                   (shell-quote-argument
+                                    (file-name-nondirectory filename)))
+                                 in-files " "))))))
              (message "Compressed %d file(s) to %s"
                       (length in-files)
                       (file-name-nondirectory out-file)))))))

Diff finished.  Fri Oct 28 09:01:25 2016





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: Forward: Re: bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-27 23:14           ` npostavs
  2016-10-28  7:06             ` José L. Doménech
@ 2016-10-28  9:22             ` José L. Doménech
  1 sibling, 0 replies; 19+ messages in thread
From: José L. Doménech @ 2016-10-28  9:22 UTC (permalink / raw)
  To: 24620

On Fri, 28 Oct 2016 01:14:49 +0200,
npostavs@users.sourceforge.net wrote:
> 
> 
> That looks pretty good.  I think it would be even nicer to use the
> `format-spec' function instead of calling `replace-regexp-in-string'
> twice.
> 
> 
Here are the changes:

--- dired-aux.orig.el	2016-10-27 15:50:50.428634418 +0200
+++ dired-aux.el	2016-10-28 09:01:08.413024427 +0200
@@ -1012,11 +1012,15 @@
           (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)
+                    (list (cons ?o (shell-quote-argument out-file))
+                          (cons ?i
+                                (mapconcat
+                                 (lambda (filename)
+                                   (shell-quote-argument
+                                    (file-name-nondirectory filename)))
+                                 in-files " "))))))
              (message "Compressed %d file(s) to %s"
                       (length in-files)
                       (file-name-nondirectory out-file)))))))

Diff finished.  Fri Oct 28 09:01:25 2016





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-28  7:06             ` José L. Doménech
@ 2016-10-29  2:06               ` npostavs
  2016-10-29  9:17                 ` José L. Doménech
  0 siblings, 1 reply; 19+ messages in thread
From: npostavs @ 2016-10-29  2:06 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

tags 24620 patch
quit

José L. Doménech <domenechjosel@gmail.com> writes:

> On Fri, 28 Oct 2016 01:14:49 +0200,
> npostavs@users.sourceforge.net wrote:
>> 
>> 
>> That looks pretty good.  I think it would be even nicer to use the
>> `format-spec' function instead of calling `replace-regexp-in-string'
>> twice.
>> 
>> 
> Here are the changes:
>
> --- dired-aux.orig.el	2016-10-27 15:50:50.428634418 +0200
> +++ dired-aux.el	2016-10-28 09:01:08.413024427 +0200
> @@ -1012,11 +1012,15 @@
>            (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)
> +                    (list (cons ?o (shell-quote-argument out-file))
> +                          (cons ?i
> +                                (mapconcat
> +                                 (lambda (filename)
> +                                   (shell-quote-argument
> +                                    (file-name-nondirectory filename)))
> +                                 in-files " "))))))
>               (message "Compressed %d file(s) to %s"
>                        (length in-files)
>                        (file-name-nondirectory out-file)))))))
>
> Diff finished.  Fri Oct 28 09:01:25 2016

Looks good.  Would you like to try writing a commit message too? (see
"Commit messages" in CONTRIBUTE).

Just a minor style suggestion: In cases like these, I like to use the
backquote syntax instead of explicit (list (cons ...))  because it saves
a bit of indentation.

Have you signed copyrigh assignment for Emacs?  This patch is small
enough to merge anyway, but if you'll be writing more patches in the
future, consider filling out the form at
git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.program
to get the process started.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-29  2:06               ` npostavs
@ 2016-10-29  9:17                 ` José L. Doménech
  2016-10-29 12:06                   ` npostavs
  0 siblings, 1 reply; 19+ messages in thread
From: José L. Doménech @ 2016-10-29  9:17 UTC (permalink / raw)
  To: npostavs; +Cc: 24620, Michael Albinus, José L. Doménech

On Sat, 29 Oct 2016 04:06:55 +0200,
npostavs@users.sourceforge.net wrote:
> 
> tags 24620 patch
> quit
> 
> 
> Looks good.  Would you like to try writing a commit message too? (see
> "Commit messages" in CONTRIBUTE).
>
Something like this?

Fix Bug#24620

* 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

> Just a minor style suggestion: In cases like these, I like to use the
> backquote syntax instead of explicit (list (cons ...))  because it saves
> a bit of indentation.
>
I changed it:

modified   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)))))))


> Have you signed copyrigh assignment for Emacs?  This patch is small
> enough to merge anyway, but if you'll be writing more patches in the
> future, consider filling out the form at
> git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.program
> to get the process started.

Yes. I just started the process by sending a e-mail with the required data.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-29  9:17                 ` José L. Doménech
@ 2016-10-29 12:06                   ` npostavs
  2016-10-29 18:40                     ` José L. Doménech
  2016-10-29 18:41                     ` José L. Doménech
  0 siblings, 2 replies; 19+ messages in thread
From: npostavs @ 2016-10-29 12:06 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

José L. Doménech <domenechjosel@gmail.com> writes:
> Something like this?
>
> Fix Bug#24620
>
> * 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
>

Almost: the summary line should ideally be readable without having to
lookup what Bug#24620 is (and the ChangeLog entry should end with a
period).

>> Have you signed copyrigh assignment for Emacs?  This patch is small
>> enough to merge anyway, but if you'll be writing more patches in the
>> future, consider filling out the form at
>> git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.program
>> to get the process started.
>
> Yes. I just started the process by sending a e-mail with the required data.

Great!





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-29 12:06                   ` npostavs
@ 2016-10-29 18:40                     ` José L. Doménech
  2016-10-29 19:42                       ` José L. Doménech
  2016-10-30  1:39                       ` npostavs
  2016-10-29 18:41                     ` José L. Doménech
  1 sibling, 2 replies; 19+ messages in thread
From: José L. Doménech @ 2016-10-29 18:40 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

On Sat, 29 Oct 2016 14:06:58 +0200,
npostavs@users.sourceforge.net wrote:
> 
> José L. Doménech <domenechjosel@gmail.com> writes:
> > Something like this?
> >
> > Fix Bug#24620
> >
> > * 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
> >
> 
> Almost: the summary line should ideally be readable without having to
> lookup what Bug#24620 is (and the ChangeLog entry should end with a
> period).
>
Sorry for the delay.
Perhaps this is more convenient:

2016-09-29  José L. Doménech  <domenechjosel@gmail.com>

Fix bug#24620: In dired enable compress to/from files whose filenames contains space characters.

	* 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

Thanks for your patiente.
> >> Have you signed copyrigh assignment for Emacs?  This patch is small
> >> enough to merge anyway, but if you'll be writing more patches in the
> >> future, consider filling out the form at
> >> git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.program
> >> to get the process started.
> >
> > Yes. I just started the process by sending a e-mail with the required data.
> 
> Great!
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-29 12:06                   ` npostavs
  2016-10-29 18:40                     ` José L. Doménech
@ 2016-10-29 18:41                     ` José L. Doménech
  1 sibling, 0 replies; 19+ messages in thread
From: José L. Doménech @ 2016-10-29 18:41 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

On Sat, 29 Oct 2016 14:06:58 +0200,
npostavs@users.sourceforge.net wrote:
> 
> José L. Doménech <domenechjosel@gmail.com> writes:
> > Something like this?
> >
> > Fix Bug#24620
> >
> > * 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
> >
> 
> Almost: the summary line should ideally be readable without having to
> lookup what Bug#24620 is (and the ChangeLog entry should end with a
> period).
>
Sorry for the delay.
Perhaps this is more convenient:

2016-09-29  José L. Doménech  <domenechjosel@gmail.com>

Fix bug#24620: In dired enable compress to/from files whose filenames contains space characters.

	* 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

Thanks for your patiente.
> >> Have you signed copyrigh assignment for Emacs?  This patch is small
> >> enough to merge anyway, but if you'll be writing more patches in the
> >> future, consider filling out the form at
> >> git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.program
> >> to get the process started.
> >
> > Yes. I just started the process by sending a e-mail with the required data.
> 
> Great!
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-29 18:40                     ` José L. Doménech
@ 2016-10-29 19:42                       ` José L. Doménech
  2016-10-30  1:39                       ` npostavs
  1 sibling, 0 replies; 19+ messages in thread
From: José L. Doménech @ 2016-10-29 19:42 UTC (permalink / raw)
  To: 24620, Michael Albinus


[-- Attachment #0: Type: message/rfc822, Size: 1330 bytes --]


2016-09-29  Jos=E9 L. Dom=E9nech  <domenechjosel@gmail.com>

Fix bug#24620: In dired enable compress to/from files whose filenames conta=
ins space characters.

	* 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

Thanks for your patiente.
> >> Have you signed copyrigh assignment for Emacs?  This patch is small
> >> enough to merge anyway, but if you'll be writing more patches in the
> >> future, consider filling out the form at
> >> git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign=
.program
> >> to get the process started.
> >
> > Yes. I just started the process by sending a e-mail with the required d=
ata.
>
> Great!
>
>
>
>





^ permalink raw reply	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-29 18:40                     ` José L. Doménech
  2016-10-29 19:42                       ` José L. Doménech
@ 2016-10-30  1:39                       ` npostavs
  2016-10-30  8:33                         ` José L. Doménech
  1 sibling, 1 reply; 19+ messages in thread
From: npostavs @ 2016-10-30  1:39 UTC (permalink / raw)
  To: José L. Doménech; +Cc: 24620, Michael Albinus

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

tags 24620 fixed
close 24620 26
quit

José L. Doménech <domenechjosel@gmail.com> 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  <domenechjosel@gmail.com>
>
> 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.


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1645 bytes --]

From 27443df092bfb4ada559f8fc024e01f174a5bcb0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Dom=C3=A9nech?= <domenechjosel@gmail.com>
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


[-- Attachment #3: Type: text/plain, Size: 150 bytes --]



>
> Thanks for your patiente.

Thanks for your contribution.

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

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters
  2016-10-30  1:39                       ` npostavs
@ 2016-10-30  8:33                         ` José L. Doménech
  0 siblings, 0 replies; 19+ messages in thread
From: José L. Doménech @ 2016-10-30  8:33 UTC (permalink / raw)
  To: npostavs; +Cc: 24620

On Sun, 30 Oct 2016 02:39:01 +0100,
npostavs@users.sourceforge.net wrote:
> 
> [1  <text/plain; utf-8 (quoted-printable)>]
> tags 24620 fixed
> close 24620 26
> quit
> 
> 
> I don't worry about delays which are approximately 0 days long :)
> 
> 
> Okay, now the summary line is a bit too long.  I shortened the summary
> and pushed your patch to master.
>
Thank you.
> [2 patch <text/plain (7bit)>]
> From 27443df092bfb4ada559f8fc024e01f174a5bcb0 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Dom=C3=A9nech?= <domenechjosel@gmail.com>
> 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
> 
> [3  <text/plain (7bit)>]
> 
> 
> 
> Thanks for your contribution.
> 
> P.S. your mails seem to be getting duplicated (or even triplicated for the
> last one).

Sorry, it is all my fault.

I still has to get a configuration for the mailinglist+NNTP+gmane
(with wanderlust) where I get comfortable so i don't resend the
messages when a error occurs in the sending process.

Thanks again.






^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-10-30  8:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-05  7:06 bug#24620: 26.0.50; In dired: 'dired-do-compress-to' fails when filenames cotains space characters José L. Doménech
2016-10-27 14:03 ` José L. Doménech
2016-10-27 17:19   ` Eli Zaretskii
2016-10-27 17:34   ` Michael Albinus
2016-10-27 18:39     ` José L. Doménech
2016-10-27 18:51       ` Noam Postavsky
2016-10-27 19:29         ` José L. Doménech
2016-10-27 23:14           ` npostavs
2016-10-28  7:06             ` José L. Doménech
2016-10-29  2:06               ` npostavs
2016-10-29  9:17                 ` José L. Doménech
2016-10-29 12:06                   ` npostavs
2016-10-29 18:40                     ` José L. Doménech
2016-10-29 19:42                       ` José L. Doménech
2016-10-30  1:39                       ` npostavs
2016-10-30  8:33                         ` José L. Doménech
2016-10-29 18:41                     ` José L. Doménech
2016-10-28  9:22             ` bug#24620: Forward: " José L. Doménech
2016-10-27 19:31         ` José L. Doménech

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).