unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8496: some file locking code in insert-file-contents cannot be right
@ 2011-04-14  0:40 Paul Eggert
  2011-04-14  6:48 ` Eli Zaretskii
  2011-04-14  8:00 ` Andreas Schwab
  0 siblings, 2 replies; 6+ messages in thread
From: Paul Eggert @ 2011-04-14  0:40 UTC (permalink / raw)
  To: 8496

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.  There's later code:

   #ifdef CLASH_DETECTION
	 if (we_locked_file)
	   unlock_file (BVAR (current_buffer, file_truename));
   #endif

that is also a no-op, because 'we_locked_file' must be zero.

GCC merrily optimizes all this code away, but I don't think
that was intended.  What *is* intended here?





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-04-14  8:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).