[Top][All Lists]

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

Buffer corruption with jka-compr.el and revert-buffer

From: Martin Schwenke
Subject: Buffer corruption with jka-compr.el and revert-buffer
Date: Mon, 26 May 2003 15:53:46 +1000

In GNU Emacs 21.3.2 and XEmacs 21.4.12 (and lots of earlier versions
of each, apparently, such as GNU Emacs 20.7), put the following code
into jka-compr-revert-bug.el:

--------8<---------8<-------- CUT HERE --------8<---------8<--------
(shell-command "echo 'aaa' | gzip > /tmp/aa.gz")
(shell-command "echo 'b' | gzip > /tmp/b.gz")
(auto-compression-mode 1)
(find-file "/tmp/aa.gz")
(shell-command "cp /tmp/b.gz /tmp/aa.gz")
(revert-buffer t t)
--------8<---------8<-------- CUT HERE --------8<---------8<--------

Now do:

  (x)emacs -q --no-site-file -l jka-compr-revert-bug.el

You probably have a buffer that looks like

--------8<---------8<-------- CUT HERE --------8<---------8<--------
--------8<---------8<-------- CUT HERE --------8<---------8<--------

Yikes!  It should just contain a 'b'!

This only seems to happen if the original file is at least 2
characters longer than the new file.  The underlying file is not
changed but, when you edit and save, the corruption obviously makes
its way into the saved file.

I've had a look at revert-buffer and nothing jumps out.  I've also had
a look at jka-compr.el and I've run away screaming...  I suspect it
would be a lot simpler without all that coding system stuff...  :-)

peace & happiness,

reply via email to

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