Subject: Re: bug#35495: 27.0.50; Untarring an archive with a keyring.gpg inside

From: Federico Tedin <[email-masked]>
Date: Thu, 09 May 2019 20:00:42 -0300

Stefan Monnier <[email-masked]> writes:

>> Would it be OK to just remove the `epa-file-handler` from
>> `file-name-handler-alist` while extracting?
>
> I don't like this idea.  How does jka-compr do it?
>
>
>         Stefan

(My attempt at understanding what's causing the issue)

It looks like `jka-compr-write-region` does not do any compression if
`file`'s extension does not match any of the extensions defined in
`jka-compr-compression-info-list`. Writing to a file ending in ".gpg"
just uses `epa-file-handler`, then.

I found that `tar-copy` has the same problem that `tar-untar-buffer`
has. However, `tar-copy` has a small check where if the source file is
compressed and the destination file should be compressed, the jka-compr
file handler is disabled, as no conversion needs to be done. Maybe
something similar could be done for .gpg files. If the file inside the
tarfile is already encrypted and it is being extracted to
<somewhere>.gpg, then the regular `write-region` should be used
(i.e. just copy bytes from one place to another).