unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 18141@debbugs.gnu.org, vincent@vinc17.net, yamaoka@jpl.org
Subject: bug#18141: 24.4.50; saving .gz file breaks file coding
Date: Thu, 07 Aug 2014 22:37:03 +0300	[thread overview]
Message-ID: <83r40sm6qo.fsf@gnu.org> (raw)
In-Reply-To: <jwvtx5o6saf.fsf-monnier+emacsbugs@gnu.org>

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: rgm@gnu.org,  18141@debbugs.gnu.org,  vincent@vinc17.net,  yamaoka@jpl.org
> Date: Thu, 07 Aug 2014 15:08:41 -0400
> 
> > Why not move the call to backup-buffer (and surrounding code that
> > deals with backup complications) from basic-save-buffer-2 to a
> > separate function, and then call that function directly from
> > write-region, right before it is about to write the new contents?
> 
> That's the hook I suggested.
> It's indeed a valid approach.  But it suffers from two problems:
> - currently write-region doesn't itself perform backups, so if we make
>   it do them always, it's an incompatible change.
> - if write-region sometimes performs backups, it'd probably be
>   controlled by some dynamic-scoped var (e.g. a hook), in which case
>   we could get "spurious" backups if write-region gets called during the
>   execution of write-region.

We could add a new optional argument to write-region to control
whether backup is performed.

> > While at that, we should IMO make the backup-then-write sequence a
> > transaction, by using the suitable unwind-protect functions, and
> > perhaps also make sure that unwind-protect function runs if Emacs is
> > killed half-way through the sequence, to keep the transaction promise.
> 
> I'm not terribly worried about this "time window" especially since
> I think it's pretty clear that we can't completely eliminate it anyway.

I think users generally expect this to be a transaction.  And at least
on Posix platforms, where rename is an atomic operation, we can
achieve this, or come pretty close.





  reply	other threads:[~2014-08-07 19:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29  6:59 bug#18141: 24.4.50; saving .gz file breaks file coding Katsumi Yamaoka
2014-07-30  0:10 ` Glenn Morris
2014-07-30  2:36   ` Katsumi Yamaoka
2014-07-30 13:15     ` Katsumi Yamaoka
2014-08-05  8:34       ` Glenn Morris
2014-08-06 14:36         ` Eli Zaretskii
2014-08-06 16:43           ` Vincent Lefevre
2014-08-06 17:32             ` Eli Zaretskii
2014-08-06 19:08               ` Vincent Lefevre
2014-08-06 19:45                 ` Eli Zaretskii
2014-08-07  0:31                   ` Vincent Lefevre
2014-08-07 12:20                     ` Stefan Monnier
2014-08-07 14:23                       ` Vincent Lefevre
2014-08-11  1:06                         ` Glenn Morris
2014-08-06 17:48           ` Stefan Monnier
2014-08-06 18:10             ` Eli Zaretskii
2014-08-07  0:45               ` Stefan Monnier
2014-08-07 15:14                 ` Eli Zaretskii
2014-08-07 19:08                   ` Stefan Monnier
2014-08-07 19:37                     ` Eli Zaretskii [this message]
2014-08-07 20:43                       ` Stefan Monnier
2014-08-08  5:51                         ` Eli Zaretskii
2014-08-06 23:45           ` Glenn Morris
2014-08-07  0:03           ` Glenn Morris
2014-08-07 12:14             ` Stefan Monnier

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=83r40sm6qo.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=18141@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=vincent@vinc17.net \
    --cc=yamaoka@jpl.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).