From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#5475: Archives with filenames with square brackets Date: Sun, 31 Jan 2010 23:59:40 +0200 Organization: JURTA Message-ID: <87zl3uorzn.fsf@mail.jurta.org> References: <874omakv2m.fsf@mail.jurta.org> <87eilca86n.fsf@stupidchicken.com> <83r5pc4jye.fsf@gnu.org> <87vden4h9x.fsf@stupidchicken.com> <83ljfj4fje.fsf@gnu.org> <87r5pavvrm.fsf@stupidchicken.com> <838wbiszy7.fsf@gnu.org> <87y6jfcg8b.fsf@mail.jurta.org> <83d40qj4av.fsf@gnu.org> <87aavua6gb.fsf@mail.jurta.org> <838wbei224.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1264976867 13437 80.91.229.12 (31 Jan 2010 22:27:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 Jan 2010 22:27:47 +0000 (UTC) Cc: 5475@debbugs.gnu.org, cyd@stupidchicken.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 31 23:27:41 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NbiGb-00088d-JL for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Jan 2010 23:27:41 +0100 Original-Received: from localhost ([127.0.0.1]:38811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NbiGb-0006Xv-1Y for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Jan 2010 17:27:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NbiGL-0006PX-DD for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2010 17:27:25 -0500 Original-Received: from [199.232.76.173] (port=58383 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NbiGK-0006PK-9Q for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2010 17:27:24 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NbiGI-0008My-Nr for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2010 17:27:23 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40023) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NbiGI-0008Mq-EB for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2010 17:27:22 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nbhwc-00057S-Bk; Sun, 31 Jan 2010 17:07:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Jan 2010 22:07:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: followup 5475 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 5475-submit@debbugs.gnu.org id=B5475.126497556819657 (code B ref 5475); Sun, 31 Jan 2010 22:07:02 +0000 Original-Received: (at 5475) by debbugs.gnu.org; 31 Jan 2010 22:06:08 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nbhvk-000570-0U for submit@debbugs.gnu.org; Sun, 31 Jan 2010 17:06:08 -0500 Original-Received: from smtp-out4.starman.ee ([85.253.0.6] helo=mx2.starman.ee) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nbhvi-00056r-VK for 5475@debbugs.gnu.org; Sun, 31 Jan 2010 17:06:07 -0500 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Original-Received: from mail.starman.ee (82.131.55.214.cable.starman.ee [82.131.55.214]) by mx2.starman.ee (Postfix) with ESMTP id 002833F4071; Mon, 1 Feb 2010 00:05:55 +0200 (EET) In-Reply-To: <838wbei224.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 31 Jan 2010 20:04:03 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 31 Jan 2010 17:07:02 -0500 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:34829 Archived-At: >> > 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/