all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Federico Tedin <federicotedin@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 35495@debbugs.gnu.org, Daiki Ueno <ueno@unixuser.org>
Subject: bug#35495: 27.0.50; Untarring an archive with a keyring.gpg inside
Date: Fri, 10 May 2019 23:20:44 -0300	[thread overview]
Message-ID: <87d0kp91fn.fsf@gmail.com> (raw)
In-Reply-To: <jwvy33d92z7.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 10 May 2019 21:54:03 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I realize that in this case I'm hard-coding the specific
>> file name handlers that *can* be used.
>
> Exactly, it's no better.
>
>> I'm not sure how to express "only use these file handlers" without
>> explicitly mentioning them.
>
> Instead, you should state the property you want, and then let each
> file-name-handler decide how to handle that property.  E.g.:
>
>     (let ((write-region-provides-raw-file-contents t))
>       (write-region ...))
>
> Of course, the problem here is that by using dynamic scoping, this var
> will affect all write-regions that will take place during this call,
> which might lead to more problems.

I see, I hadn't realized that tar-mode still used dynamic scoping (I
imagine converting it to lexical is a lot of work).

> Maybe it would be better to have it as an argument to `write-region`, or
> to introduce a new function?
>
> Or maybe, not use `write-region` but `copy-file` instead (which already
> provides the expected semantics (i.e. it doesn't (un)compress or
> (en/de)crypt, IIUC).

It looks like `copy-file` only deals with files and not buffers, so we
would need to find a way to use it from tar-mode. Looking at the source
in fileio.c, it also seems like it uses `find-file-name-handler` for
`FILE` or `NEWNAME`, so it's possible it won't be useful for us.

If we added a new argument to `write-region` like you mentioned, say
`RAW`, could we then use symbol properties to decide whether the found
file name handler can be used or not? Like so:

(put 'jka-compr-handler 'provides-raw-file-contents nil)
(put 'epa-file-handler 'provides-raw-file-contents nil)

(put 'tramp-file-name-handler 'provides-raw-file-contents t)
(put 'tramp-completion-file-name-handler 'provides-raw-file-contents t)
(put 'file-name-non-special 'provides-raw-file-contents t)

The downside being that anyone adding a new file name handler must
remember to set the property to t if needed.





  reply	other threads:[~2019-05-11  2:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 20:02 bug#35495: 27.0.50; Untarring an archive with a keyring.gpg inside Stefan Monnier
2019-05-08 22:26 ` Federico Tedin
2019-05-09  0:53   ` Stefan Monnier
2019-05-09 23:00     ` Federico Tedin
2019-05-10  0:24       ` Stefan Monnier
2019-05-11  0:26         ` Federico Tedin
2019-05-11  0:37           ` Stefan Monnier
2019-05-11  1:43             ` Federico Tedin
2019-05-11  1:54               ` Stefan Monnier
2019-05-11  2:20                 ` Federico Tedin [this message]
2019-05-11 12:54                   ` Stefan Monnier
2019-05-11 16:24                     ` Federico Tedin
2019-05-11  6:48         ` Eli Zaretskii
2019-05-11 12:55           ` Stefan Monnier
2019-05-11 13:06             ` Eli Zaretskii
2019-05-11 14:10               ` Stefan Monnier
2019-05-11 14:22                 ` Eli Zaretskii
2019-05-11 19:55                   ` Stefan Monnier
2019-05-12  4:20                     ` Eli Zaretskii
2019-05-12 15:23                       ` Stefan Monnier
2019-05-12 15:57                         ` Eli Zaretskii
2022-04-22 13:13 ` Lars Ingebrigtsen
2022-04-22 13:40   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-22 14:18     ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d0kp91fn.fsf@gmail.com \
    --to=federicotedin@gmail.com \
    --cc=35495@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=ueno@unixuser.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.