unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Buffer corruption with jka-compr.el and revert-buffer
@ 2003-05-26  5:53 Martin Schwenke
  2003-05-26  9:36 ` Stephen J. Turnbull
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Schwenke @ 2003-05-26  5:53 UTC (permalink / raw)


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<--------
b
a
--------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,
martin

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

end of thread, other threads:[~2003-05-27  6:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-26  5:53 Buffer corruption with jka-compr.el and revert-buffer Martin Schwenke
2003-05-26  9:36 ` Stephen J. Turnbull
2003-05-26 23:50   ` Martin Schwenke
2003-05-27  6:28     ` Martin Schwenke

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