From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25458: 25.1; tar mode does not handle compressed archives without specific extensions Date: Sat, 14 May 2022 09:15:19 +0300 Message-ID: <83wneoljwo.fsf@gnu.org> References: <87o801serb.fsf@gnus.org> <83ilq9ms6n.fsf@gnu.org> <871qwx2zv8.fsf@gnus.org> <838rr5mnej.fsf@gnu.org> <87r14xm5nj.fsf@tucano.isti.cnr.it> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36578"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 25458@debbugs.gnu.org, larsi@gnus.org To: Francesco =?UTF-8?Q?Potort=C3=AC?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 14 08:17:04 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1npl5L-0009Jq-FL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 May 2022 08:17:03 +0200 Original-Received: from localhost ([::1]:54638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npl5K-0003M3-4V for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 May 2022 02:17:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npl4N-0003KM-Gy for bug-gnu-emacs@gnu.org; Sat, 14 May 2022 02:16:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npl4L-0000ui-Rp for bug-gnu-emacs@gnu.org; Sat, 14 May 2022 02:16:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1npl4L-0001u5-Mm for bug-gnu-emacs@gnu.org; Sat, 14 May 2022 02:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 May 2022 06:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25458 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 25458-submit@debbugs.gnu.org id=B25458.16525089197257 (code B ref 25458); Sat, 14 May 2022 06:16:01 +0000 Original-Received: (at 25458) by debbugs.gnu.org; 14 May 2022 06:15:19 +0000 Original-Received: from localhost ([127.0.0.1]:45598 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npl3f-0001sz-In for submit@debbugs.gnu.org; Sat, 14 May 2022 02:15:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npl3e-0001sk-BG for 25458@debbugs.gnu.org; Sat, 14 May 2022 02:15:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:50600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npl3Y-0000LJ-02; Sat, 14 May 2022 02:15:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=3eKwTup+jFUk9WZZyxRnscish56R7VjshoEArVPJDCA=; b=laybLSN9BJdBsWkwwHlG XIgxeQXT87LIYRAYp+bLpkpzqJ+bj0FTHh0qotIt3AprNPCkZwe6H1HTgOLuhsrU5l69mZxVL1NQb 2xjvjJarxMA0N514PAI9L4wlzmTvxgiV1RPVwzGr/x8xxbHlPa2L+RQDZ50jMIX9mg9QnkyPpy1nn imB4O5wjqCkcNwQouIUrkn+nL7EgilYXQDdDniG6eNmySdIYE9ppuxB6GF/2L+pGVsB9DOXZK/+hg Q4zXREpQKknmU8l/VWYg5MV6MwVbNp9PpDtuRhGX0aBMAVDHdMGqArwOO/hGYvjwWd8UB3vCsGtUN ct1pPgalxDcneA==; Original-Received: from [87.69.77.57] (port=4888 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npl3X-0006VX-Br; Sat, 14 May 2022 02:15:11 -0400 In-Reply-To: <87r14xm5nj.fsf@tucano.isti.cnr.it> (message from Francesco =?UTF-8?Q?Potort=C3=AC?= on Sat, 14 May 2022 00:25:36 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:232213 Archived-At: > From: Francesco Potortì > Date: Sat, 14 May 2022 00:25:36 +0200 > Cc: 25458@debbugs.gnu.org, > Lars Ingebrigtsen > > >Then I guess I don't understand what is the problem we are asked to > >fix here. Francesco, can you explain? > > If I read foo.tar into Emacs, where foo.tar was created with > > $ tar -Jcf foo.tar any.file.name > > then Emacs does not recognise it as a tar file. Instead, it should look at it, understand that it is a compressed tar file, uncompress and parse it. If asked to save it after modification, it should compress it before saving, using the same compression method that was used in the first place. You could do that by using magic-mode-alist, I guess? It's just a matter of writing the FUNCTION to put into the association for the magic signatures of the compression methods you want to support. FWIW, I don't think Emacs should do this by default, because looking at the file's contents before looking at its file-name extension will slow down visiting files, and having a .tar file that is actually a .tar.xz file is quite unusual in the wild. So this sounds like your personal preference, and therefore customizing magic-mode-alist for you sounds like TRT to fulfill your personal needs. > Compression would be transparent to Emacs if it relied on Tar for parsing the tar file, because Tar manages compressed files transparently. But since Emacs parses the tar file itself, it should behave as Tar does, that is, uncompress the file if it was compressed in the first place, and recompress when saving it after editing. I don't think it's a good idea for Emacs to require Tar for visiting archives. For starters, Tar is not always available, and when it is available, it doesn't always support all the compression methods people could use. We could use bsdtar (from libarchive), which supports every archive format and compression method under the sun, but its availability is even less than that of Tar. So I think what we have now hits a good balance between functionality in the popular use cases and reliability.