From unknown Sat Jun 21 08:39:17 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#10347 <10347@debbugs.gnu.org> To: bug#10347 <10347@debbugs.gnu.org> Subject: Status: 24.0.50; archive-mode includes warning messages from unzip in the content of extracted files Reply-To: bug#10347 <10347@debbugs.gnu.org> Date: Sat, 21 Jun 2025 15:39:17 +0000 retitle 10347 24.0.50; archive-mode includes warning messages from unzip in= the content of extracted files reassign 10347 emacs submitter 10347 Daniel Brooks severity 10347 minor thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 21 20:39:09 2011 Received: (at submit) by debbugs.gnu.org; 22 Dec 2011 01:39:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RdXch-0007wF-F0 for submit@debbugs.gnu.org; Wed, 21 Dec 2011 20:39:09 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RdU0Z-0002jU-VF for submit@debbugs.gnu.org; Wed, 21 Dec 2011 16:47:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RdTyW-0003qE-JL for submit@debbugs.gnu.org; Wed, 21 Dec 2011 16:45:25 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, T_MIME_NO_TEXT, T_TVD_MIME_NO_HEADERS autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:46059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdTyW-0003qA-Hk for submit@debbugs.gnu.org; Wed, 21 Dec 2011 16:45:24 -0500 Received: from eggs.gnu.org ([140.186.70.92]:39184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdTyU-0001IR-Ny for bug-gnu-emacs@gnu.org; Wed, 21 Dec 2011 16:45:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RdTyT-0003pm-00 for bug-gnu-emacs@gnu.org; Wed, 21 Dec 2011 16:45:22 -0500 Received: from caiajhbdcbef.dreamhost.com ([208.97.132.145]:42952 helo=homiemail-a26.g.dreamhost.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdTyS-0003pF-M7 for bug-gnu-emacs@gnu.org; Wed, 21 Dec 2011 16:45:20 -0500 Received: from homiemail-a26.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a26.g.dreamhost.com (Postfix) with ESMTP id 4D226B8056 for ; Wed, 21 Dec 2011 13:45:14 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=db48x.net; h=from:to:subject:date :message-id:mime-version:content-type; q=dns; s=db48x.net; b=QNE kuOc3gBVkQEpXFBIxJSRoDkK7kVONvXwvXaSrTdzeXI5O/fR/795UnC2g8C30df1 7WiLYYqrMv/Fx2ajgHay1L5bugcoY25v8y4Kkoe2OLyMYqG7BssKqwkc6FekZmA5 ZfMmv92SF6Z6StgVSBjkGi36CooU2vxrrw9xPg2A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=db48x.net; h=from:to :subject:date:message-id:mime-version:content-type; s=db48x.net; bh=9hpfcW/0vvnEfv0BXbI2Xre8xaU=; b=YVWpo/Da2svOt0iLI7Y6uI32q85v o6K/PW5BUStI0968wdpicljfTilw/Jx/3oeQ7kjb6v9s8SQLubf91ryJLMZ4+0y+ TUBZCy87xZEhPyYsPK62Ncf0J1frELlt+E09Ccn00sac6/d2gaPKo+JJ3sXDV7GU W9qzdYNMbqcjCTg= Received: from celebdil (c-98-207-254-3.hsd1.ca.comcast.net [98.207.254.3]) (Authenticated sender: db48x@db48x.net) by homiemail-a26.g.dreamhost.com (Postfix) with ESMTPA id 20646B8077 for ; Wed, 21 Dec 2011 13:44:57 -0800 (PST) From: Daniel Brooks To: bug-gnu-emacs@gnu.org Subject: 24.0.50; archive-mode includes warning messages from unzip in the content of extracted files Date: Wed, 21 Dec 2011 13:44:56 -0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 21 Dec 2011 20:39:05 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) --=-=-= 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. --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=archive-mode-stdout.bundle Content-Transfer-Encoding: base64 Content-Description: fix IyB2MiBnaXQgYnVuZGxlCi01NWNlZDNjNzBkNGM2YTVhNTI0OWZkYjk2Y2Y1Nzk3MDI1NTA1ZDk1 IFVwZGF0ZSBwcm9ncmFtcy50ZXhpIGFuZCBjYy1tb2RlLnRleGkgZm9yIG5ldyBDQyBNb2RlIGZl YXR1cmVzOiBjYy1tb2RlLnRleGk6IFVwZGF0ZSB2ZXJzaW9uIHN0cmluZyB0byA1LjMyLiBwcm9n cmFtcy50ZXhpOiBEZXNjcmliZSAiZ3Vlc3NpbmciIG9mIGluZGVudGF0aW9uIHN0eWxlLiAgVXBk YXRlIEMtTS1hL2UuCmE1NmZlZTgzY2Y4ZWQ5MmE4NWE3N2JmYWE3ZDQyMmVmZTJiNTA2NTggSEVB RAoKUEFDSwAAAAIAAAAFlht4nJ1QwU7DMAy95yt83JBa0ixpWoQQAs78Q5q4a0SbVIm7Db6eMODA lYst28/vPZsSIhxMo6RWutNqaMSg0La2Ez0OSo6tbLkRchBd27DVJAwESll0B6u5k7Y1yigh+9EN fWtHpXvNhVJcuV4xs9EUE7yY4HGGpxTjW4Z7N8ju8niNdUB6gOYgpOy07DVUvOOc2bgsngj/scqe Y0poCWzJ20o+Bogj4IWSsYQORj9jBh/AJDv5E1ZLdAjWbLkMzxMGoAlhjtbMsIUPv8Ka4jGZBfLq KUPcCM4mBR+OpQiQyWFKNWM3MPu83hbaK2VdbO9+NX7kq+G9KvhCsb+DVzyVAxd/ge8WnD1N7Ev8 r9lySaDy9gy7AvRhX7NP4e2O5/kDekGuc/logCzfQQzJhzUZBtv13hh4nAE5AMb/vAm8CZDKFEl4 s1hOBTggHbRJlHBEmxediUPVsd5ZAhTei1U3W60IH9PYSljTDIYbCMbL1bNLA3EBo8kXkv8KYF7z K1mJeVzKqdblu1FirccO4z94nHu0TPjfcuF6IwNDQ11DI10jAwUFl8S8zNQcBaei/PzsYgUFm5Qk E4sKBzCpl5daYsfFxamlkJNZXKCfWJSsm5ufkqoHVK4B5GRklqXqplaUFCUml+gmVeoWl6Tkl5Zo Win4pZalFinkZlYoQIS4OMszSzIUSjJSFcDKZZNLUlMU0jJzUhWS8/NKUvNKihU0gEoz8zT1uLga WhhbmFqYt7AkXQYAA4A7HPECx7aPvYlokvHuSqw0VkgRv1+DUWV4nFsevjx8AzOLyIF34rnu+1u4 +Zbu7ZyVy6pxe3+nyWZxlgnqAO3PDZj2AoFikRZvrmtis9cXeEmENGhItHPteJxbs4Z15hrWDfdW CudkFpcolCgUl6SkFhXppmXmpGpOFj+vsFllFccaAD/2D7qi+5r+2Cxzt/E0VXy4yyfuyEWeeA== --=-=-= In GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) of 2010-07-23 on celebdil configured using `configure '--prefix=/home/db48x'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Group Minor modes in effect: gnus-topic-mode: t gnus-undo-mode: t erc-track-mode: t erc-services-mode: t erc-ring-mode: t erc-page-mode: t erc-networks-mode: t erc-netsplit-mode: t erc-menu-mode: t erc-match-mode: t erc-log-mode: t erc-list-mode: t erc-dcc-mode: t erc-pcomplete-mode: t erc-capab-identify-mode: t erc-button-mode: t erc-stamp-mode: t erc-autojoin-mode: t iswitchb-mode: t erc-irccontrols-mode: t erc-noncommands-mode: t erc-move-to-prompt-mode: t erc-readonly-mode: t savehist-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: DEL DEL DEL DEL DEL r e p o r TAB RET w a r n i n g SPC m e s s a g e s SPC f r o m SPC z i p u DEL / u n z i p SPC g e t SPC i n c l u d e d ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O C DEL DEL DEL DEL DEL ESC [ 3 ~ C-a C-k a r c h i v e - m o d e SPC i n d l u c e DEL DEL d e s SPC w a r n i n g SPC ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D DEL c C-e m e s s a g e s SPC f r o m SPC u n z i p SPC i n SPC t h e SPC c o n t e n t SPC o f SPC e x t r a c t e d SPC f i l e s RET ESC O A ESC O B C-x C-c q n o RET C-x k RET y e s RET C-x 1 ESC x g n u s RET y ESC c ESC x ESC p ESC p RET Recent messages: Pinging home mail+nnimap+home mail:INBOX.junk...done INBOX.junk Pinging home mail...done INBOX.junk Pinging home mail+nnimap+home mail:INBOX.junk...done INBOX.junk Pinging home mail...done INBOX.junk nnimap: Setting marks in INBOX...done INBOX Load-path shadows: ~/elisp/remember-latest/remember hides /home/db48x/share/emacs/24.0.50/lisp/textmodes/remember ~/elisp/xscheme hides /home/db48x/share/emacs/24.0.50/lisp/progmodes/xscheme /home/db48x/share/emacs/24.0.50/lisp/erc/erc-list hides ~/elisp/erc-extras/erc-list Features: (gnus-topic gnus-mlspl utf-7 utf7 nnimap imap parse-time nnfolder nndraft nnmh bbdb-gnus bbdb-snarf bbdb-com cl cl-19 auth-source netrc gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-cache gnus-art mm-uu mml2015 epg-config mm-view smime password-cache dig mailcap gnus-sum spam-stat gnus-demon nntp gnus-group gnus-undo nnmail mail-source nnoo gnus-start gnus-spec gnus-int gnus-range gnus-win gnus gnus-ems nnheader shadow gnus-util mail-extr message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader emacsbug server add-log jka-compr find-func multi-isearch vc-git package erc-track erc-services erc-ring erc-page erc-networks erc-netsplit erc-menu erc-match erc-log erc-dcc erc-pcomplete time-date erc-capab erc-button erc-fill erc-stamp erc-join iswitchb erc-goodies erc erc-backend erc-compat format-spec planner-id compile comint ring planner cal-menu calendar cal-loaddefs sort muse-html muse-xml-common muse-colors pcomplete muse-publish muse-project muse-protocols mb-depth two-column bookmark pp info muse-regexps derived muse muse-nested-tags muse-mode bbdb-autoloads bbdb timezone xscheme scheme icicles icicles-mode advice help-fns advice-preload dired regexp-opt icicles-cmd2 easy-mmode icicles-cmd1 cus-edit cus-start cus-load icicles-mcmd help-mode easymenu view icicles-mac icicles-fn icicles-var icicles-opt edmacro kmacro ffap wid-edit icicles-face thingatpt hexrgb savehist tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 22 15:11:25 2011 Received: (at 10347) by debbugs.gnu.org; 22 Dec 2011 20:11:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Rdoz7-0001yA-8h for submit@debbugs.gnu.org; Thu, 22 Dec 2011 15:11:25 -0500 Received: from smarty.dreamhost.com ([208.113.175.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Rdoz5-0001y3-7W for 10347@debbugs.gnu.org; Thu, 22 Dec 2011 15:11:23 -0500 Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id 8720E684059; Thu, 22 Dec 2011 12:09:11 -0800 (PST) Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 3934F451C6F3; Thu, 22 Dec 2011 12:08:38 -0800 (PST) From: Juri Linkov To: Daniel Brooks Subject: Re: bug#10347: 24.0.50; archive-mode includes warning messages from unzip in the content of extracted files Organization: JURTA References: Date: Thu, 22 Dec 2011 22:07:05 +0200 In-Reply-To: (Daniel Brooks's message of "Wed, 21 Dec 2011 13:44:56 -0800") Message-ID: <874nwsbcc4.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10347 Cc: 10347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 24 08:21:54 2011 Received: (at 10347) by debbugs.gnu.org; 24 Dec 2011 13:21:54 +0000 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 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 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= 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) From: Daniel Brooks To: Juri Linkov Subject: Re: bug#10347: 24.0.50; archive-mode includes warning messages from unzip in the content of extracted files In-Reply-To: <874nwsbcc4.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 22 Dec 2011 22:07:05 +0200") Date: Thu, 22 Dec 2011 14:23:30 -0800 References: <874nwsbcc4.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: 10347 Cc: 10347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) 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 From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 16:57:38 2011 Received: (at 10347) by debbugs.gnu.org; 25 Dec 2011 21:57:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Rew4Y-0005uR-JF for submit@debbugs.gnu.org; Sun, 25 Dec 2011 16:57:38 -0500 Received: from smarty.dreamhost.com ([208.113.175.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Rew4W-0005uI-Ro for 10347@debbugs.gnu.org; Sun, 25 Dec 2011 16:57:37 -0500 Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id EB96F6840C7; Sun, 25 Dec 2011 13:55:06 -0800 (PST) Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 7C1AE451C686; Sun, 25 Dec 2011 13:54:30 -0800 (PST) From: Juri Linkov To: Daniel Brooks Subject: Re: bug#10347: 24.0.50; archive-mode includes warning messages from unzip in the content of extracted files Organization: JURTA References: <874nwsbcc4.fsf@mail.jurta.org> Date: Sun, 25 Dec 2011 23:27:05 +0200 In-Reply-To: (Daniel Brooks's message of "Thu, 22 Dec 2011 14:23:30 -0800") Message-ID: <877h1kxsaw.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10347 Cc: 10347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) > 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. We can't remove special treatment of the 7z archiver because it produces large output even on successful runs, so displaying it would be annoying. I'd rather move the logic of displaying errors to `archive-extract-by-stdout' where `stderr-test' defines the condition when not to display the output redirected to stderr (in case of 7z it searches for the known regexp, otherwise checks the buffer's size). 1. Tested it with "unzip": (setq archive-zip-extract '("unzip" "-qq" "-c")) 1.1. Visiting `omni.jar' displays in the echo area: warning [omni.jar]: 6552040 extra bytes at beginning or within zipfile (attempting to process anyway) error [omni.jar]: reported length of central directory is -6552040 bytes too long (Atari STZip zipfile? J.H.Holm ZIPSPLIT 1.1 zipfile?). Compensating... 1.2. Visiting the hand-edited `browser.jar' displays in the echo area: content/browser/aboutDialog.xul bad CRC 1ded366d (should be b80ec225) 2. Tested with using "7z": (setq archive-zip-extract '("7z" "x" "-so")) 2.1. Visiting `omni.jar' displays in the echo area: Processing archive: omni.jar Error: Can not open file as archive 2.2. Visiting the hand-edited `browser.jar' displays in the echo area: Processing archive: browser.jar Extracting content/browser/aboutDialog.xul CRC Failed Sub items Errors: 1 This all errors are reported to the user and easyly noticeable. === modified file 'lisp/arc-mode.el' --- lisp/arc-mode.el 2011-12-15 07:24:10 +0000 +++ lisp/arc-mode.el 2011-12-25 21:27:01 +0000 @@ -1113,13 +1114,24 @@ (defun archive-*-extract (archive name c (archive-delete-local tmpfile) success)) -(defun archive-extract-by-stdout (archive name command &optional stderr-file) - (apply 'call-process - (car command) - nil - (if stderr-file (list t stderr-file) t) - nil - (append (cdr command) (list archive name)))) +(defun archive-extract-by-stdout (archive name command &optional stderr-test) + (let ((stderr-file (make-temp-file "arc-stderr"))) + (unwind-protect + (prog1 + (apply 'call-process + (car command) + nil + (if stderr-file (list t stderr-file) t) + nil + (append (cdr command) (list archive name))) + (with-temp-buffer + (insert-file-contents stderr-file) + (when (if (stringp stderr-test) + (not (search-forward stderr-test nil t)) + (> (buffer-size) 0)) + (message "%s" (buffer-string))))) + (if (file-exists-p stderr-file) + (delete-file stderr-file))))) (defun archive-extract-other-window () "In archive mode, find this member in another window." @@ -2095,17 +2125,11 @@ (defun archive-7z-summarize () (apply 'vector files)))) (defun archive-7z-extract (archive name) - (let ((tmpfile (make-temp-file "7z-stderr"))) - ;; 7z doesn't provide a `quiet' option to suppress non-essential - ;; stderr messages. So redirect stderr to a temp file and display it - ;; in the echo area when it contains error messages. - (prog1 (archive-extract-by-stdout - archive name archive-7z-extract tmpfile) - (with-temp-buffer - (insert-file-contents tmpfile) - (unless (search-forward "Everything is Ok" nil t) - (message "%s" (buffer-string))) - (delete-file tmpfile))))) + ;; 7z doesn't provide a `quiet' option to suppress non-essential + ;; stderr messages. So redirect stderr to a temp file and display it + ;; in the echo area when it contains no message indicating success. + (archive-extract-by-stdout + archive name archive-7z-extract "Everything is Ok")) (defun archive-7z-write-file-member (archive descr) (archive-*-write-file-member From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 16:57:42 2011 Received: (at 10347) by debbugs.gnu.org; 25 Dec 2011 21:57:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Rew4b-0005uh-QI for submit@debbugs.gnu.org; Sun, 25 Dec 2011 16:57:42 -0500 Received: from smarty.dreamhost.com ([208.113.175.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Rew4Y-0005uQ-M1 for 10347@debbugs.gnu.org; Sun, 25 Dec 2011 16:57:39 -0500 Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id 5EB30684091; Sun, 25 Dec 2011 13:55:09 -0800 (PST) Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id E65B5451C686; Sun, 25 Dec 2011 13:54:32 -0800 (PST) From: Juri Linkov To: Daniel Brooks Subject: Re: bug#10347: 24.0.50; archive-mode includes warning messages from unzip in the content of extracted files Organization: JURTA References: <874nwsbcc4.fsf@mail.jurta.org> Date: Sun, 25 Dec 2011 23:28:52 +0200 In-Reply-To: (Daniel Brooks's message of "Thu, 22 Dec 2011 14:23:30 -0800") Message-ID: <877h1kwdd3.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10347 Cc: 10347@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Actually, `archive-rar-extract' has exactly the same problem. When `unrar-free' can't extract some files from RAR archives, it displays a confusing message: Removing old name: no such file or directory, /tmp/arc-rar1971TAO/file.txt It needs the same treatment as 7z and zip. But the difference is that `unrar-free' outputs only to stdout, not to stderr. And when the operation is successful, it outputs long text with the known fixed message "All OK" indicating success. So we should check for this message, and not display a message on success. Here is a patch that adds `archive-extract-by-file' for RAR archives: === modified file 'lisp/arc-mode.el' --- lisp/arc-mode.el 2011-12-15 07:24:10 +0000 +++ lisp/arc-mode.el 2011-12-25 21:27:01 +0000 @@ -1996,23 +2008,41 @@ (defun archive-rar-summarize (&optional (insert sep (make-string maxname ?-) "\n") (apply 'vector files)))) +(defun archive-extract-by-file (archive name command &optional stdout-test) + (let ((dest (make-temp-file "arc-dir" 'dir)) + (stdout-file (make-temp-file "arc-stdout"))) + (unwind-protect + (prog1 + (apply 'call-process + (car command) + nil + `(:file ,stdout-file) + nil + (append (cdr command) (list archive name dest))) + (with-temp-buffer + (insert-file-contents stdout-file) + (when (if (stringp stdout-test) + (not (search-forward stdout-test nil t)) + (> (buffer-size) 0)) + (message "%s" (buffer-string)))) + (if (file-exists-p (expand-file-name name dest)) + (insert-file-contents-literally (expand-file-name name dest)))) + (if (file-exists-p stdout-file) + (delete-file stdout-file)) + (if (file-exists-p (expand-file-name name dest)) + (delete-file (expand-file-name name dest))) + (while (file-name-directory name) + (setq name (directory-file-name (file-name-directory name))) + (delete-directory (expand-file-name name dest))) + (delete-directory dest)))) + (defun archive-rar-extract (archive name) ;; unrar-free seems to have no way to extract to stdout or even to a file. (if (file-name-absolute-p name) ;; The code below assumes the name is relative and may do undesirable ;; things otherwise. (error "Can't extract files with non-relative names") - (let ((dest (make-temp-file "arc-rar" 'dir))) - (unwind-protect - (progn - (call-process "unrar-free" nil nil nil - "--extract" archive name dest) - (insert-file-contents-literally (expand-file-name name dest))) - (delete-file (expand-file-name name dest)) - (while (file-name-directory name) - (setq name (directory-file-name (file-name-directory name))) - (delete-directory (expand-file-name name dest))) - (delete-directory dest))))) + (archive-extract-by-file archive name '("unrar-free" "--extract") "All OK"))) ;;; Section: Rar self-extracting .exe archives. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 28 12:39:37 2012 Received: (at 10347-done) by debbugs.gnu.org; 28 Sep 2012 16:39:37 +0000 Received: from localhost ([127.0.0.1]:60703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THdbE-0002mj-0G for submit@debbugs.gnu.org; Fri, 28 Sep 2012 12:39:36 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:43826 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THdbA-0002ma-Hz for 10347-done@debbugs.gnu.org; Fri, 28 Sep 2012 12:39:33 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 46A35451CCA1 for <10347-done@debbugs.gnu.org>; Fri, 28 Sep 2012 09:39:20 -0700 (PDT) From: Juri Linkov To: 10347-done@debbugs.gnu.org Subject: Re: bug#10347: 24.0.50; archive-mode includes warning messages from unzip in the content of extracted files Organization: JURTA References: Date: Fri, 28 Sep 2012 19:38:38 +0300 In-Reply-To: (Daniel Brooks's message of "Wed, 21 Dec 2011 13:44:56 -0800") Message-ID: <87bogq2jch.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10347-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Version: 24.3 Thanks, this is fixed now and closed. From unknown Sat Jun 21 08:39:17 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 27 Oct 2012 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator