GNU bug report logs - #10347
24.0.50; archive-mode includes warning messages from unzip in the content of extracted files

Previous Next

Package: emacs;

Reported by: Daniel Brooks <db48x <at> db48x.net>

Date: Thu, 22 Dec 2011 01:40:02 UTC

Severity: minor

Found in version 24.0.50

Fixed in version 24.3

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

Bug is archived. No further changes may be made.

Full log


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

From: Daniel Brooks <db48x <at> db48x.net>
To: Juri Linkov <juri <at> jurta.org>
Cc: 10347 <at> debbugs.gnu.org
Subject: Re: bug#10347: 24.0.50;
	archive-mode includes warning messages from unzip in the content of
	extracted files
Date: Thu, 22 Dec 2011 14:23:30 -0800
Juri Linkov <juri <at> jurta.org> writes:

>> archive-extract-by-stdout intermingles stderr and stdout unless the
>> caller passes in a buffer to send the stderr too. As none of the callers
>> do, I think it would be best to disable stderr unless the caller
>> supplies a buffer.
>
>> [2. fix --- application/octet-stream; archive-mode-stdout.bundle]...
>
> Unfortunately, I can't read what you've encrypted into this git bundle.
>
> But I think we should use the same solution as we developed for
> `archive-7z-extract' - to redirect stdout into a temporary file
> and display its contents in the echo area.
>

It is a binary file, which is unfortunate. Mercurial has a way to export
a commit (or a set of commits) with all of the necessary metadata as a
text file that I really like, but I digress.

> This patch fixes `archive-zip-extract' by duplicating the logic of
> `archive-7z-extract':

Yes, this is a good idea. However, let's avoid duplicating the code by
defining a function. Here's what I've got so far, although it doesn't
actually display the messages, for whatever reason. I'll debug it when I
get a spare minute.

diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 00023a6..442a258 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1113,7 +1113,7 @@ using `make-temp-file', and the generated name is returned."
     (archive-delete-local tmpfile)
     success))
 
-(defun archive-extract-by-stdout (archive name command &optional stderr-file)
+(defun archive-extract-by-stdout-with-stderr (archive name command &optional stderr-file)
   (apply 'call-process
 	 (car command)
 	 nil
@@ -1121,6 +1121,16 @@ using `make-temp-file', and the generated name is returned."
 	 nil
 	 (append (cdr command) (list archive name))))
 
+(defun archive-extract-by-stdout (archive name command)
+  (let ((tmpfile (make-temp-file "zip-stderr")))
+      (prog1 (archive-extract-by-stdout archive name command tmpfile)
+        (with-temp-buffer
+          (insert-file-contents tmpfile)
+          (if (buffer-size)
+              (message "%s" (buffer-string)))
+          (delete-file tmpfile)))))
+
 (defun archive-extract-other-window ()
   "In archive mode, find this member in another window."
   (interactive)
@@ -1826,9 +1836,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
     (let ((archive-7z-extract archive-zip-extract))
       (archive-7z-extract archive name)))
    (t
-    (let ((tmpfile (make-temp-file "zip-stderr")))
-      (prog1 (archive-extract-by-stdout
-     archive
+    (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
@@ -1840,13 +1848,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
 	      (equal (car archive-zip-extract) "unzip"))
 	 (shell-quote-argument name)
        name)
-              archive-zip-extract
-              tmpfile)
-        (with-temp-buffer
-          (insert-file-contents tmpfile)
-          (unless (search-forward "Everything is Ok" nil t)
-            (message "%s" (buffer-string)))
-          (delete-file tmpfile)))))))
+     archive-zip-extract))))
 
 (defun archive-zip-write-file-member (archive descr)
   (archive-*-write-file-member




This bug report was last modified 12 years and 239 days ago.

Previous Next


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