GNU bug report logs - #8496
some file locking code in insert-file-contents cannot be right

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Thu, 14 Apr 2011 00:42:02 UTC

Severity: normal

Done: Andreas Schwab <schwab <at> linux-m68k.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: eggert <at> cs.ucla.edu, 8496 <at> debbugs.gnu.org
Subject: bug#8496: some file locking code in insert-file-contents cannot be right
Date: Thu, 14 Apr 2011 04:55:14 -0400
> Date: Thu, 14 Apr 2011 02:48:28 -0400
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 8496 <at> debbugs.gnu.org
> Reply-To: Eli Zaretskii <eliz <at> gnu.org>
> 
> >      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 */

Sorry, that was wrong.  The previous version was this:

   if (NILP (visit) && total > 0)
     prepare_to_modify_buffer (PT, PT, NULL);

The ChangeLog entry for the change (in revision 62259) is this:

     (Finsert_file_contents): If we read 0 bytes from a special file,
     unlock the visited file if we locked it.




This bug report was last modified 14 years and 41 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.