all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: 5475@debbugs.gnu.org
Subject: bug#5475: Archives with filenames with square brackets
Date: Tue, 26 Jan 2010 23:47:37 +0200	[thread overview]
Message-ID: <83r5pc4jye.fsf@gnu.org> (raw)
In-Reply-To: <87eilca86n.fsf@stupidchicken.com>

> From: Chong Yidong <cyd@stupidchicken.com>
> 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.






  reply	other threads:[~2010-01-26 21:47 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 [this message]
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
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=83r5pc4jye.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=5475@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    /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.