all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 5475@debbugs.gnu.org, cyd@stupidchicken.com
Subject: bug#5475: Archives with filenames with square brackets
Date: Sun, 31 Jan 2010 23:59:40 +0200	[thread overview]
Message-ID: <87zl3uorzn.fsf@mail.jurta.org> (raw)
In-Reply-To: <838wbei224.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 31 Jan 2010 20:04:03 +0200")

>> > 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	other threads:[~2010-01-31 21:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-25 17:48 bug#5475: Archives with filenames with square brackets Juri Linkov
2010-01-26 21:05 ` Chong Yidong
2010-01-26 21:47   ` Eli Zaretskii
2010-01-27 16:57     ` Chong Yidong
2010-01-27 17:35       ` Eli Zaretskii
2010-01-28 20:07         ` Chong Yidong
2010-01-28 21:05           ` Eli Zaretskii
2010-01-28 21:24             ` Lennart Borgman
2010-01-28 22:00               ` Eli Zaretskii
2010-01-30 22:59             ` Juri Linkov
2010-01-31  4:18               ` Eli Zaretskii
2010-01-31 10:56                 ` Juri Linkov
2010-01-31 18:04                   ` Eli Zaretskii
2010-01-31 21:59                     ` Juri Linkov [this message]
2010-02-01  4:15                       ` Eli Zaretskii
2010-02-01 10:34                         ` Juri Linkov
2010-02-01 11:48                           ` Lennart Borgman
2010-02-01 15:43                           ` Stefan Monnier
2010-02-01 21:55                             ` Juri Linkov
2010-02-02  0:11                               ` Lennart Borgman
2010-02-02  0:46                                 ` Juri Linkov
2010-02-02  4:03                               ` Eli Zaretskii
2010-04-18 23:14                               ` Juri Linkov
2010-02-01 19:49                           ` Eli Zaretskii
2010-02-01 21:21                             ` Drew Adams
2010-02-01 21:52                               ` Eli Zaretskii
2010-02-01 22:04                                 ` Drew Adams
2010-02-01 22:39                             ` Juri Linkov
2010-02-01 22:41                             ` Lennart Borgman
2010-02-02  0:10                               ` Lennart Borgman
2010-02-02  0:42                                 ` Juri Linkov
2010-02-02  1:30                                   ` Lennart Borgman
2010-02-02 10:03                                     ` Juri Linkov
2010-02-03  0:17                                       ` Lennart Borgman
2010-02-03  0:35                                         ` Juri Linkov
2010-02-03 23:54                                           ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zl3uorzn.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=5475@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.