unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Francesco Potortì" <pot@gnu.org>
Cc: 25458@debbugs.gnu.org, larsi@gnus.org
Subject: bug#25458: 25.1; tar mode does not handle compressed archives without specific extensions
Date: Sat, 14 May 2022 09:15:19 +0300	[thread overview]
Message-ID: <83wneoljwo.fsf@gnu.org> (raw)
In-Reply-To: <87r14xm5nj.fsf@tucano.isti.cnr.it> (message from Francesco Potortì on Sat, 14 May 2022 00:25:36 +0200)

> From: Francesco Potortì <pot@gnu.org>
> Date: Sat, 14 May 2022 00:25:36 +0200
> Cc: 25458@debbugs.gnu.org,
> 	Lars Ingebrigtsen <larsi@gnus.org>
> 
> >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.





  reply	other threads:[~2022-05-14  6:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 15:20 bug#25458: 25.1; tar mode does not handle compressed archives without specific extensions Francesco Potortì
2022-05-13 14:12 ` Lars Ingebrigtsen
2022-05-13 14:18   ` Eli Zaretskii
2022-05-13 14:45     ` Francesco Potortì
2022-05-13 15:53     ` Lars Ingebrigtsen
2022-05-13 16:02       ` Eli Zaretskii
2022-05-13 22:25         ` Francesco Potortì
2022-05-14  6:15           ` Eli Zaretskii [this message]
2022-05-13 14:36   ` Francesco Potortì
2022-05-13 15:54     ` Lars Ingebrigtsen
2022-05-13 22:18       ` Francesco Potortì
2022-05-14  1:13         ` Lars Ingebrigtsen
2022-05-16 14:24           ` Francesco Potortì

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=83wneoljwo.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=25458@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=pot@gnu.org \
    /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).