GNU bug report logs - #5475
Archives with filenames with square brackets

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Mon, 25 Jan 2010 17:58:02 UTC

Severity: normal

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 5475 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 5475 <at> debbugs.gnu.org
Subject: Re: Archives with filenames with square brackets
Date: Tue, 26 Jan 2010 16:05:20 -0500
> 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).
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)))




This bug report was last modified 15 years and 37 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.