bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [msoulier: auto-revert-mode corrupting files with cvs checkin]


From: Anders Lindgren
Subject: Re: [msoulier: auto-revert-mode corrupting files with cvs checkin]
Date: 28 Feb 2002 10:21:11 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi Michael and the bugs lists!

It sound like a real problem to me, and I have a suspicion on what
might be the cause of the problem.

My guess is that Emacs, as soon as it notices that the file has been
changed, reverts the file.  If this is done before CVS has finished
rewriting the file then the content of the file is in a bit of a flux.
When CVS has finished writing the file Emacs might think that is has
the latest copy and, hence, do no perform any more reverts.  (This can
be verified if an extra, manual, revert is performed and the buffer
looks good afterwards.  On the other hand, if the FILE itself contains
garbage then we have a bigger, more serious, problem on our hands.)

auto-revert-mode has very limited ways of checking if a file needs to
be updated.  Technically the only functionality it has is the function
`verify-visited-file-modtime'.  So, in order to fix auto-revert-mode
this function needs to handle this kind of situations.  I can see two
ways to accomplish this (although I have limited knowledge of the
inner workings of the function):

1) Do not consider a file being updated as a candidate for reverts.
   This will make auto-revert wait until the update has been completed
   before it reverts the file.

2) Ensure that the function notices that the file has changed "again"
   so that auto-revert can reverts it a second time.  I do not know
   how the modification dates works (if it is the open, close, or
   last-write, that is checked) but we must find a way to detect that
   the the writer has finished updating the file.

The drawback of suggestion 1) is that it will make it impossible to
follow a log file that is being generated.  This is a very nice
feature that I personally would not want to miss.

    -- Anders

"Michael P. Soulier" <msoulier@nortelnetworks.com> writes:

>     Hello. 
> 
>     This is a copy of a bug report I just submitted. If it's invalid, please
> let me know and I'll follow up with that information. If it's valid, I'd love
> to help in any way I can to solve it. 
> 
>     Any insights?
> 
>     Thanks,
> 
>     Mike
> 
> -- 
> Michael P. Soulier, QX41, SKY  Tel: 613-765-4699 (ESN: 39-54699)
> Optical Networks, Nortel Networks, SDE Pegasus
> "...the word HACK is used as a verb to indicate a massive amount
> of nerd-like effort."  -Harley Hahn, A Student's Guide to Unix
> Subject: auto-revert-mode corrupting files with cvs checkin
> To: submit@bugs.debian.org
> Date: Wed, 27 Feb 2002 13:09:26 -0500
> 
> Package: emacs21
> Version: 21.1-7
> 
> I have global-auto-revert-mode enabled on several buffers that I am editing.
> The corresponding files are in a CVS sandbox on an NFS-mounted filesystem.
> When I am done my editing, I'm finding that if I go to a shell and do a "cvs
> ci" on the files to check them in, the buffers immediately auto-revert due to
> the fact that CVS is updating the keywords ($Id: $ specifically). 
> 
> The problem is that after auto-revert, in many of the buffers I find strings
> of null chars at the end. 
> 
> ie. ^@^@^@^@^@^@^@^@^@^@^@^@^@^@
> 
> This only happens so far with the combination of CVS and Emacs'
> auto-revert-mode. Using Vim's equivalent, it works fine, so I suspect
> auto-revert-mode and not CVS. 


-- 
;; .signature -- File added to the end of mail, containing joke or info.
(defvar me '((profession . "Compiler Designer") (company . "IAR Systems")
  (age . 32) (country . "Sweden") (water-skier . t) (lindy-hopper . t)))
;; .signature ends here.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]