unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Daniel Brooks <db48x@db48x.net>
Cc: 10347@debbugs.gnu.org
Subject: bug#10347: 24.0.50; archive-mode includes warning messages from unzip in the content of extracted files
Date: Thu, 22 Dec 2011 22:07:05 +0200	[thread overview]
Message-ID: <874nwsbcc4.fsf@mail.jurta.org> (raw)
In-Reply-To: <m3pqfhr44n.fsf@db48x.net> (Daniel Brooks's message of "Wed, 21 Dec 2011 13:44:56 -0800")

> 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.

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

=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el	2011-12-15 07:24:10 +0000
+++ lisp/arc-mode.el	2011-12-22 20:05:51 +0000
@@ -1826,7 +1827,8 @@ (defun archive-zip-extract (archive name
     (let ((archive-7z-extract archive-zip-extract))
       (archive-7z-extract archive name)))
    (t
-    (archive-extract-by-stdout
+    (let ((tmpfile (make-temp-file "zip-stderr")))
+      (prog1 (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
@@ -1839,7 +1841,13 @@ (defun archive-zip-extract (archive name
 	      (equal (car archive-zip-extract) "unzip"))
 	 (shell-quote-argument name)
        name)
-     archive-zip-extract))))
+	      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)))))))
 
 (defun archive-zip-write-file-member (archive descr)
   (archive-*-write-file-member





  reply	other threads:[~2011-12-22 20:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 21:44 bug#10347: 24.0.50; archive-mode includes warning messages from unzip in the content of extracted files Daniel Brooks
2011-12-22 20:07 ` Juri Linkov [this message]
2011-12-22 22:23   ` Daniel Brooks
2011-12-25 21:27     ` Juri Linkov
2011-12-25 21:28     ` Juri Linkov
2012-09-28 16:38 ` 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874nwsbcc4.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=10347@debbugs.gnu.org \
    --cc=db48x@db48x.net \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).