emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 714942b1c37: Fix extraction of files with wildcards in names from


From: Eli Zaretskii
Subject: master 714942b1c37: Fix extraction of files with wildcards in names from zip archives
Date: Thu, 28 Dec 2023 09:52:29 -0500 (EST)

branch: master
commit 714942b1c3767ee6c70a5644d6a4460dedbe4422
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix extraction of files with wildcards in names from zip archives
    
    * lisp/arc-mode.el (archive-zip-extract): Quote wildcard
    characters in file names as [C].  (Bug#67926)
---
 lisp/arc-mode.el | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index c861c835966..f54211e3320 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -2108,16 +2108,14 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
    (t
     (archive-extract-by-stdout
      archive
-     ;; unzip expands wildcards in NAME, so we need to quote it.  But
-     ;; not on DOS/Windows, since that fails extraction on those
-     ;; systems (unless w32-quote-process-args is nil), and file names
-     ;; with wildcards in zip archives don't work there anyway.
-     ;; FIXME: Does pkunzip need similar treatment?
-     (if (and (or (not (memq system-type '(windows-nt ms-dos)))
-                 (and (boundp 'w32-quote-process-args)
-                      (null w32-quote-process-args)))
-             (equal (car archive-zip-extract) "unzip"))
-        (shell-quote-argument name)
+     ;; unzip expands wildcard characters in NAME, so we need to quote
+     ;; wildcard characters in a special way: replace each such
+     ;; character C with a single-character alternative [C].  We
+     ;; cannot use 'shell-quote-argument' here because that doesn't
+     ;; protect wildcard characters from being expanded by unzip
+     ;; itself.
+     (if (equal (car archive-zip-extract) "unzip")
+         (replace-regexp-in-string "[[?*]" "[\\&]" name)
        name)
      archive-zip-extract))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]