[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5475: Archives with filenames with square brackets
From: |
Eli Zaretskii |
Subject: |
bug#5475: Archives with filenames with square brackets |
Date: |
Tue, 26 Jan 2010 23:47:37 +0200 |
> 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.
- bug#5475: Archives with filenames with square brackets, Juri Linkov, 2010/01/25
- bug#5475: Archives with filenames with square brackets, Chong Yidong, 2010/01/26
- bug#5475: Archives with filenames with square brackets,
Eli Zaretskii <=
- bug#5475: Archives with filenames with square brackets, Chong Yidong, 2010/01/27
- bug#5475: Archives with filenames with square brackets, Eli Zaretskii, 2010/01/27
- bug#5475: Archives with filenames with square brackets, Chong Yidong, 2010/01/28
- bug#5475: Archives with filenames with square brackets, Eli Zaretskii, 2010/01/28
- bug#5475: Archives with filenames with square brackets, Lennart Borgman, 2010/01/28
- bug#5475: Archives with filenames with square brackets, Eli Zaretskii, 2010/01/28
- bug#5475: Archives with filenames with square brackets, Juri Linkov, 2010/01/30
- bug#5475: Archives with filenames with square brackets, Eli Zaretskii, 2010/01/30
- bug#5475: Archives with filenames with square brackets, Juri Linkov, 2010/01/31
- bug#5475: Archives with filenames with square brackets, Eli Zaretskii, 2010/01/31