bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5475: Archives with filenames with square brackets


From: Juri Linkov
Subject: bug#5475: Archives with filenames with square brackets
Date: Sun, 31 Jan 2010 23:59:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (x86_64-pc-linux-gnu)

>> > Right, looks like a bug.
>> >
>> > Btw, I looked into 7z, and it doesn't have the same problem as unzip.
>> > So we probably should only quote with unzip.
>> 
>> Does the following patch look right?  At least, it fixes a bug, and
>> after feature freeze we could add more data structures to defcustom to
>> indicate whether the file name needs to be quoted.
>
> Looks okay to me, except that perhaps compare strings
> case-insensitively instead of just with `equal'.

There are more problems.

When I try to set `archive-zip-extract' to ("7z" "x" "-so") it puts some
unnecessary information (header lines, progress indication, etc.)  to
the output buffer, because it outputs this to stderr.  With the following
change, stderr goes to /dev/null, but there is no chance to see possible errors
(this patch is for demonstration only, not to be installed):

=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el    2010-01-28 20:06:36 +0000
+++ lisp/arc-mode.el    2010-01-31 21:48:51 +0000
@@ -1080,7 +1080,7 @@ (defun archive-extract-by-stdout (archiv
   (apply 'call-process
         (car command)
         nil
-        t
+        '(t nil)
         nil
         (append (cdr command) (list archive name))))
 
To process 7z in the correct branch, the following patch is needed,
where any values other than pkunzip/pkzip are processed by
archive-extract-by-stdout instead of archive-*-extract,
where "unzip" needs to quote its filenames.

So I propose to install the following patch, and add more
changes for 7z processing after feature freeze.

=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el    2010-01-28 20:06:36 +0000
+++ lisp/arc-mode.el    2010-01-31 21:48:51 +0000
@@ -1782,12 +1782,17 @@ (defun archive-zip-summarize ()
     (apply 'vector (nreverse files))))
 
 (defun archive-zip-extract (archive name)
-  (if (equal (car archive-zip-extract) "pkzip")
+  (if (member-ignore-case (car archive-zip-extract) '("pkunzip" "pkzip"))
       (archive-*-extract archive name archive-zip-extract)
     ;; unzip expands wildcards in NAME, so we need to quote it.
-    ;; FIXME: Does pkzip need similar treatment?
-    (archive-extract-by-stdout archive (shell-quote-argument name)
-                              archive-zip-extract)))
+    ;; FIXME: Does pkunzip need similar treatment?
+    ;; (7z doesn't need to quote wildcards)
+    (archive-extract-by-stdout
+     archive
+     (if (equal (car archive-zip-extract) "unzip")
+        (shell-quote-argument name)
+       name)
+     archive-zip-extract)))
 
 (defun archive-zip-write-file-member (archive descr)
   (archive-*-write-file-member

-- 
Juri Linkov
http://www.jurta.org/emacs/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]