From unknown Sat Jun 21 05:19:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#34251: 27.0.50; Use pretty ugly hack for tar-extract Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Jan 2019 21:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34251 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 34251@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.154879656828512 (code B ref -1); Tue, 29 Jan 2019 21:17:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Jan 2019 21:16:08 +0000 Received: from localhost ([127.0.0.1]:50882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1goajm-0007Pn-5F for submit@debbugs.gnu.org; Tue, 29 Jan 2019 16:16:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41075) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1goajk-0007Oj-I0 for submit@debbugs.gnu.org; Tue, 29 Jan 2019 16:16:04 -0500 Received: from lists.gnu.org ([209.51.188.17]:57238) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goaje-0001kI-NU for submit@debbugs.gnu.org; Tue, 29 Jan 2019 16:15:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goajd-00056g-PA for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 16:15:58 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goajb-0001ip-Dn for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 16:15:57 -0500 Received: from common.maple.relay.mailchannels.net ([23.83.214.38]:32989) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goajZ-0001gA-0q for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 16:15:53 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 6CD345C49DD for ; Tue, 29 Jan 2019 21:15:48 +0000 (UTC) Received: from pdx1-sub0-mail-a62.g.dreamhost.com (unknown [100.96.19.74]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E694B5C23E9 for ; Tue, 29 Jan 2019 21:15:47 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a62.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Tue, 29 Jan 2019 21:15:48 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Print-Relation: 1642a8db0dbb1d32_1548796548230_2215458282 X-MC-Loop-Signature: 1548796548230:3210444564 X-MC-Ingress-Time: 1548796548230 Received: from pdx1-sub0-mail-a62.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTP id 8FD9F80120 for ; Tue, 29 Jan 2019 13:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=1JLKQhiBWdOubnZpS50byl5f+DQ=; b=2ScOIXhysCTNVyIFe va1s7Lhd+63yeqUmPnOBCNWwQYtH2uqgX5elu1d/28oYEK5GXVnWnWMCciaqOmqK VE5PV6jZMEtg9eB0ccljAXXP1X8O0IeLrf9FVp46rhbgDHTlbrdtQOKvwAulZwMV grWESvxHJLG6TPM6OHgb+57nyU= Received: from mail.jurta.org (m91-129-110-202.cust.tele2.ee [91.129.110.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTPSA id BE90480124 for ; Tue, 29 Jan 2019 13:15:46 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a62 From: Juri Linkov Organization: LINKOV.NET Date: Tue, 29 Jan 2019 22:54:43 +0200 Message-ID: <87womnnrv0.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtledrjedvgddugeelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohffkfgfgggtsehmtderredtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddutddrvddtvdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrdduuddtrddvtddvpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 23.83.214.38 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch 0. cd /tmp 1. echo "test" | gzip > test.gz 2. zip test.zip test.gz 3. C-x C-f test.zip RET 4. RET ('archive-extract' to visit the first file) -- file content is nicely displayed ungzipped from zip archive. 1. echo "test" | gzip > test.gz 2. tar zcvf test.tar.gz test.gz 3. C-x C-f test.tar.gz RET 4. RET ('tar-extract' to visit the first file) -- garbage is displayed instead of ungzipped file content. The reason why gzipped files can be visited from arc-mode archives is because of this line in arc-mode.el in 'archive-extract' with this comment: (defun archive-extract (&optional other-window-p event) ... (archive-try-jka-compr) ;Pretty ugly hack :-( ... To support gzipped files in tar archives as well, this patch copies the same pretty ugly hack from arc-mode.el to tar-mode.el: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tar-extract-try-jka-compr.patch diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 5b83d173b4..6f537df8e8 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -852,6 +852,26 @@ tar-mouse-extract (goto-char (posn-point (event-end event))) (tar-extract)) +(defun tar--try-jka-compr () + (when (and auto-compression-mode + (jka-compr-get-compression-info buffer-file-name)) + (let* ((basename (file-name-nondirectory buffer-file-name)) + (tmpname (if (string-match ":\\([^:]+\\)\\'" basename) + (match-string 1 basename) basename)) + (tmpfile (make-temp-file (file-name-sans-extension tmpname) + nil + (file-name-extension tmpname 'period)))) + (unwind-protect + (progn + (let ((coding-system-for-write 'no-conversion) + ;; Don't re-compress this data just before decompressing it. + (jka-compr-inhibit t)) + (write-region (point-min) (point-max) tmpfile nil 'quiet)) + (erase-buffer) + (let ((coding-system-for-read 'no-conversion)) + (insert-file-contents tmpfile))) + (delete-file tmpfile))))) + (defun tar-file-name-handler (op &rest args) "Helper function for `tar-extract'." (or (eq op 'file-exists-p) @@ -931,6 +951,7 @@ tar-extract (setq buffer-file-name new-buffer-file-name) (setq buffer-file-truename (abbreviate-file-name buffer-file-name)) + (tar--try-jka-compr) ;Pretty ugly hack :-( ;; Force buffer-file-coding-system to what ;; decode-coding-region actually used. (set-buffer-file-coding-system last-coding-system-used t) --=-=-=-- From unknown Sat Jun 21 05:19:07 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Juri Linkov Subject: bug#34251: closed (Re: bug#34251: 27.0.50; Use pretty ugly hack for tar-extract) Message-ID: References: <874l9kk2nj.fsf@mail.linkov.net> <87womnnrv0.fsf@mail.linkov.net> X-Gnu-PR-Message: they-closed 34251 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 34251@debbugs.gnu.org Date: Sun, 03 Feb 2019 21:02:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1549227722-17690-1" This is a multi-part message in MIME format... ------------=_1549227722-17690-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #34251: 27.0.50; Use pretty ugly hack for tar-extract which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 34251@debbugs.gnu.org. --=20 34251: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D34251 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1549227722-17690-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 34251-done) by debbugs.gnu.org; 3 Feb 2019 21:01:33 +0000 Received: from localhost ([127.0.0.1]:57800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gqOtQ-0004ae-Ty for submit@debbugs.gnu.org; Sun, 03 Feb 2019 16:01:33 -0500 Received: from bisque.maple.relay.mailchannels.net ([23.83.214.18]:25798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gqOtO-0004aU-Al for 34251-done@debbugs.gnu.org; Sun, 03 Feb 2019 16:01:30 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E9D81121C7C for <34251-done@debbugs.gnu.org>; Sun, 3 Feb 2019 21:01:28 +0000 (UTC) Received: from pdx1-sub0-mail-a23.g.dreamhost.com (unknown [100.96.11.179]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 9DD5C123B3C for <34251-done@debbugs.gnu.org>; Sun, 3 Feb 2019 21:01:28 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a23.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Sun, 03 Feb 2019 21:01:28 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Gusty-Bottle: 643c8dee724ee1f7_1549227688741_784967425 X-MC-Loop-Signature: 1549227688741:2673986355 X-MC-Ingress-Time: 1549227688741 Received: from pdx1-sub0-mail-a23.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a23.g.dreamhost.com (Postfix) with ESMTP id 5F7DF818BB for <34251-done@debbugs.gnu.org>; Sun, 3 Feb 2019 13:01:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=XwUkdXSuHYAai5oG9sdPoSDreyM=; b= Om4afKOBpNaHFq3lSVDZjVj86+N7nH54f59j+WYlIMo5DF+QsvqWZ2uUOfrUfVGb SiJ8jKcyW7n2+yZizxRjLhWOyKq5FUyDEeDUvMykcnod+Gt7B6Sy5UUWjnbqiTFb SKetgkMz9hfnVcTvg6DON4TERhOZmUm9cvl3WIQNbyQ= Received: from mail.jurta.org (m91-129-111-71.cust.tele2.ee [91.129.111.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a23.g.dreamhost.com (Postfix) with ESMTPSA id 75C8F818C5 for <34251-done@debbugs.gnu.org>; Sun, 3 Feb 2019 13:01:26 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a23 From: Juri Linkov To: 34251-done@debbugs.gnu.org Subject: Re: bug#34251: 27.0.50; Use pretty ugly hack for tar-extract Organization: LINKOV.NET References: <87womnnrv0.fsf@mail.linkov.net> Date: Sun, 03 Feb 2019 23:01:04 +0200 In-Reply-To: <87womnnrv0.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 29 Jan 2019 22:54:43 +0200") Message-ID: <874l9kk2nj.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtledrkedvgddugeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledrudduuddrjedunecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledrudduuddrjedupdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepfeegvdehuddqughonhgvseguvggssghughhsrdhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 34251-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > To support gzipped files in tar archives as well, this patch > copies the same pretty ugly hack from arc-mode.el to tar-mode.el: Since etc/TODO has the following entry: ** Give Tar mode all the features of Archive mode. I committed the fix to master. Also enabled Unicode support in archive/tar gz files, and added tests. ------------=_1549227722-17690-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 29 Jan 2019 21:16:08 +0000 Received: from localhost ([127.0.0.1]:50882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1goajm-0007Pn-5F for submit@debbugs.gnu.org; Tue, 29 Jan 2019 16:16:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41075) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1goajk-0007Oj-I0 for submit@debbugs.gnu.org; Tue, 29 Jan 2019 16:16:04 -0500 Received: from lists.gnu.org ([209.51.188.17]:57238) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goaje-0001kI-NU for submit@debbugs.gnu.org; Tue, 29 Jan 2019 16:15:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goajd-00056g-PA for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 16:15:58 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goajb-0001ip-Dn for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 16:15:57 -0500 Received: from common.maple.relay.mailchannels.net ([23.83.214.38]:32989) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goajZ-0001gA-0q for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 16:15:53 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 6CD345C49DD for ; Tue, 29 Jan 2019 21:15:48 +0000 (UTC) Received: from pdx1-sub0-mail-a62.g.dreamhost.com (unknown [100.96.19.74]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E694B5C23E9 for ; Tue, 29 Jan 2019 21:15:47 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a62.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Tue, 29 Jan 2019 21:15:48 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Print-Relation: 1642a8db0dbb1d32_1548796548230_2215458282 X-MC-Loop-Signature: 1548796548230:3210444564 X-MC-Ingress-Time: 1548796548230 Received: from pdx1-sub0-mail-a62.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTP id 8FD9F80120 for ; Tue, 29 Jan 2019 13:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=1JLKQhiBWdOubnZpS50byl5f+DQ=; b=2ScOIXhysCTNVyIFe va1s7Lhd+63yeqUmPnOBCNWwQYtH2uqgX5elu1d/28oYEK5GXVnWnWMCciaqOmqK VE5PV6jZMEtg9eB0ccljAXXP1X8O0IeLrf9FVp46rhbgDHTlbrdtQOKvwAulZwMV grWESvxHJLG6TPM6OHgb+57nyU= Received: from mail.jurta.org (m91-129-110-202.cust.tele2.ee [91.129.110.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTPSA id BE90480124 for ; Tue, 29 Jan 2019 13:15:46 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a62 From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: 27.0.50; Use pretty ugly hack for tar-extract Organization: LINKOV.NET Date: Tue, 29 Jan 2019 22:54:43 +0200 Message-ID: <87womnnrv0.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtledrjedvgddugeelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohffkfgfgggtsehmtderredtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddutddrvddtvdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrdduuddtrddvtddvpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 23.83.214.38 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch 0. cd /tmp 1. echo "test" | gzip > test.gz 2. zip test.zip test.gz 3. C-x C-f test.zip RET 4. RET ('archive-extract' to visit the first file) -- file content is nicely displayed ungzipped from zip archive. 1. echo "test" | gzip > test.gz 2. tar zcvf test.tar.gz test.gz 3. C-x C-f test.tar.gz RET 4. RET ('tar-extract' to visit the first file) -- garbage is displayed instead of ungzipped file content. The reason why gzipped files can be visited from arc-mode archives is because of this line in arc-mode.el in 'archive-extract' with this comment: (defun archive-extract (&optional other-window-p event) ... (archive-try-jka-compr) ;Pretty ugly hack :-( ... To support gzipped files in tar archives as well, this patch copies the same pretty ugly hack from arc-mode.el to tar-mode.el: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tar-extract-try-jka-compr.patch diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 5b83d173b4..6f537df8e8 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -852,6 +852,26 @@ tar-mouse-extract (goto-char (posn-point (event-end event))) (tar-extract)) +(defun tar--try-jka-compr () + (when (and auto-compression-mode + (jka-compr-get-compression-info buffer-file-name)) + (let* ((basename (file-name-nondirectory buffer-file-name)) + (tmpname (if (string-match ":\\([^:]+\\)\\'" basename) + (match-string 1 basename) basename)) + (tmpfile (make-temp-file (file-name-sans-extension tmpname) + nil + (file-name-extension tmpname 'period)))) + (unwind-protect + (progn + (let ((coding-system-for-write 'no-conversion) + ;; Don't re-compress this data just before decompressing it. + (jka-compr-inhibit t)) + (write-region (point-min) (point-max) tmpfile nil 'quiet)) + (erase-buffer) + (let ((coding-system-for-read 'no-conversion)) + (insert-file-contents tmpfile))) + (delete-file tmpfile))))) + (defun tar-file-name-handler (op &rest args) "Helper function for `tar-extract'." (or (eq op 'file-exists-p) @@ -931,6 +951,7 @@ tar-extract (setq buffer-file-name new-buffer-file-name) (setq buffer-file-truename (abbreviate-file-name buffer-file-name)) + (tar--try-jka-compr) ;Pretty ugly hack :-( ;; Force buffer-file-coding-system to what ;; decode-coding-region actually used. (set-buffer-file-coding-system last-coding-system-used t) --=-=-=-- ------------=_1549227722-17690-1--