From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#5475: Archives with filenames with square brackets Date: Tue, 26 Jan 2010 23:47:37 +0200 Message-ID: <83r5pc4jye.fsf@gnu.org> References: <874omakv2m.fsf@mail.jurta.org> <87eilca86n.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1264544605 31585 80.91.229.12 (26 Jan 2010 22:23:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jan 2010 22:23:25 +0000 (UTC) Cc: 5475@debbugs.gnu.org To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 26 23:23:17 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.50) id 1NZtoS-0002D7-Ro for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Jan 2010 23:23:14 +0100 Original-Received: from localhost ([127.0.0.1]:42514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZtoG-00019f-HW for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Jan 2010 17:22:56 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZtbh-0004ao-2M for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2010 17:09:57 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZtbd-0004X3-1R for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2010 17:09:56 -0500 Original-Received: from [199.232.76.173] (port=35516 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZtbc-0004Wr-OQ for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2010 17:09:52 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53598) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NZtbc-00019f-Bk for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2010 17:09:52 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NZtIQ-0005hs-Jl; Tue, 26 Jan 2010 16:50:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Jan 2010 21:50: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.126454255721914 (code B ref 5475); Tue, 26 Jan 2010 21:50:02 +0000 Original-Received: (at 5475) by debbugs.gnu.org; 26 Jan 2010 21:49:17 +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 1NZtHg-0005hP-Ha for submit@debbugs.gnu.org; Tue, 26 Jan 2010 16:49:16 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NZtHd-0005hJ-4G for 5475@debbugs.gnu.org; Tue, 26 Jan 2010 16:49:15 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0KWV00H00HXEEE00@a-mtaout22.012.net.il> for 5475@debbugs.gnu.org; Tue, 26 Jan 2010 23:47:34 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.127.180.161]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KWV009NYJ797QP0@a-mtaout22.012.net.il>; Tue, 26 Jan 2010 23:47:34 +0200 (IST) In-reply-to: <87eilca86n.fsf@stupidchicken.com> X-012-Sender: halo1@inter.net.il X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list X-Spam-Score: -2.0 (--) Resent-Date: Tue, 26 Jan 2010 16:50: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:34736 Archived-At: > From: Chong Yidong > Date: Tue, 26 Jan 2010 16:05:20 -0500 > Cc: 5475@debbugs.gnu.org > > > When a zip archive contains a file with square brackets in its name > > (e.g. "file[name].txt") then visiting this file displays an error: > > > > caution: filename not matched: file[name].txt > > I assume this is a specific quirk of unzip that it handles square > brackets specially (characters like * seem to be handled literally). I think it treats all wildcard characters the same. A `*' may not cause a warning because a file whose name is literally foo*, matches the wildcard foo*. > How about this patch? > > *** lisp/arc-mode.el 2010-01-13 08:35:10 +0000 > --- lisp/arc-mode.el 2010-01-26 21:03:54 +0000 > *************** > *** 1782,1787 **** > --- 1782,1791 ---- > (apply 'vector (nreverse files)))) > > (defun archive-zip-extract (archive name) > + (when (string-match "[][]" name) > + (require 'comint) > + (let ((comint-file-name-quote-list '(?\] ?\[))) > + (setq name (comint-quote-filename name)))) > (if (equal (car archive-zip-extract) "pkzip") > (archive-*-extract archive name archive-zip-extract) > (archive-extract-by-stdout archive name archive-zip-extract))) First, why not use shell-quote-argument, instead of requiring comint? Second, could someone please see if pkzip also expands wildcards internally? If it does not, the quoting will need to be done only in the non-pkzip branch. We also need to test this on MS-Windows. But most importantly, this patch is not clean, IMO: it hardcodes into archive-zip-extract (the function) some knowledge of what can be the possible values of archive-zip-extract the defcustom. What if tomorrow there will be a 3rd possibility, in addition to pkzip and unzip? That is why I thought about some less trivial patch: add to the data structures that are values of these defcustom's a flag to indicate whether the file name needs to be quoted or not.