From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 8496@debbugs.gnu.org
Subject: bug#8496: some file locking code in insert-file-contents cannot be right
Date: Thu, 14 Apr 2011 02:48:28 -0400 [thread overview]
Message-ID: <E1QAGLs-0008AI-9M@fencepost.gnu.org> (raw)
In-Reply-To: <4DA64291.5060207@cs.ucla.edu> (message from Paul Eggert on Wed, 13 Apr 2011 17:40:49 -0700)
> Date: Wed, 13 Apr 2011 17:40:49 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
>
> As a result of the "mark unexported symbols 'static'" patch that I'm
> working on, in the Emacs trunk I found some file-locking code inside
> insert-file-contents that cannot be right:
>
> if (NILP (visit) && inserted > 0)
> {
> #ifdef CLASH_DETECTION
> if (!NILP (BVAR (current_buffer, file_truename))
> /* Make binding buffer-file-name to nil effective. */
> && !NILP (BVAR (current_buffer, filename))
> && SAVE_MODIFF >= MODIFF)
> we_locked_file = 1;
> #endif /* CLASH_DETECTION */
> prepare_to_modify_buffer (GPT, GPT, NULL);
> }
>
> The above code is equivalent to a no-op, since 'inserted' must
> be zero here.
In Emacs 21.4a, the corresponding code was this:
if (!NILP (visit))
{
...
#ifdef CLASH_DETECTION
if (NILP (handler))
{
if (!NILP (current_buffer->file_truename))
unlock_file (current_buffer->file_truename);
unlock_file (filename);
}
#endif /* CLASH_DETECTION */
The change to the present form was between 21.4a and 22.1. It appears
in the trunk history as part of a huge merge from a branch, probably
the Emacs 22.1 release branch. I need more forensic work to find out
why the change was made, but at this point it certainly looks like
someone goofed with the condition.
What platforms use CLASH_DETECTION?
next prev parent reply other threads:[~2011-04-14 6:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 0:40 bug#8496: some file locking code in insert-file-contents cannot be right Paul Eggert
2011-04-14 6:48 ` Eli Zaretskii [this message]
2011-04-14 7:53 ` Paul Eggert
2011-04-14 8:07 ` Eli Zaretskii
2011-04-14 8:55 ` Eli Zaretskii
2011-04-14 8:00 ` Andreas Schwab
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=E1QAGLs-0008AI-9M@fencepost.gnu.org \
--to=eliz@gnu.org \
--cc=8496@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
/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).