From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Brooks Newsgroups: gmane.emacs.bugs Subject: 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 Message-ID: References: <874nwsbcc4.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1324732791 29910 80.91.229.12 (24 Dec 2011 13:19:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 24 Dec 2011 13:19:51 +0000 (UTC) Cc: 10347@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 24 14:19:47 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ReRVq-0004SM-UK for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Dec 2011 14:19:47 +0100 Original-Received: from localhost ([::1]:44525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ReRVq-0006ef-Gg for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Dec 2011 08:19:46 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:38098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ReRVn-0006ea-PR for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2011 08:19:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ReRVm-0002zX-KR for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2011 08:19:43 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ReRVl-0002zP-65 for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2011 08:19:42 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1ReRY2-00013x-1M for bug-gnu-emacs@gnu.org; Sat, 24 Dec 2011 08:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Brooks Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Dec 2011 13:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10347-submit@debbugs.gnu.org id=B10347.13247329144016 (code B ref 10347); Sat, 24 Dec 2011 13:22:01 +0000 Original-Received: (at 10347) by debbugs.gnu.org; 24 Dec 2011 13:21:54 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ReRXt-00012i-KZ for submit@debbugs.gnu.org; Sat, 24 Dec 2011 08:21:53 -0500 Original-Received: from caiajhbdcagg.dreamhost.com ([208.97.132.66] helo=homiemail-a34.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ReRXp-00012Z-Nb for 10347@debbugs.gnu.org; Sat, 24 Dec 2011 08:21:52 -0500 Original-Received: from homiemail-a34.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a34.g.dreamhost.com (Postfix) with ESMTP id 98F3910059; Sat, 24 Dec 2011 05:19:27 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=db48x.net; h=from:to:cc:subject :in-reply-to:date:references:message-id:mime-version: content-type; q=dns; s=db48x.net; b=XIcH2raksEyyTe8luUEOZAEUe69n fPldgcmZ15len9BxD7spb36lKBOpOLbCcBLPCPS6GmAwZx7exncUTlBeefV4tHyl rwqxrKIg0pliXWcMFFoGKLZaV5KNjPFxmSwVc5AM0GsUCNlTmeLsUoLpO3ql9pOA ZAiKGMEHlb1eXB8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=db48x.net; h=from:to:cc :subject:in-reply-to:date:references:message-id:mime-version: content-type; s=db48x.net; bh=Pz1ddrXp6Pxxqgzyx93IfHAAKfU=; b=gG zsxAL5oTn2DgTcGGxqz1JdSlH9UMxC+LMGdIWo1LsGRXCOHdmHjMKVQ7JSHI2JBv a0Vi05fUnuP2vaES3FKmjvtDiSzsj4D0541I307bGyWbtVjqK7U9ayIoYZHuJcZw e+MyHlnHrt7mUFFJqlEWQMES8SAtxaClGafRyJgj4= Original-Received: from celebdil (c-98-207-254-3.hsd1.ca.comcast.net [98.207.254.3]) (Authenticated sender: db48x@db48x.net) by homiemail-a34.g.dreamhost.com (Postfix) with ESMTPA id 3C92510058; Sat, 24 Dec 2011 05:19:27 -0800 (PST) In-Reply-To: <874nwsbcc4.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 22 Dec 2011 22:07:05 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 24 Dec 2011 08:22:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:55155 Archived-At: Juri Linkov 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