all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jonathan Underwood <jonathan.underwood@gmail.com>
To: bug-gnu-emacs@gnu.org
Subject: bug#5313: editing files in hexl-mode corrupts file
Date: Mon, 4 Jan 2010 13:35:46 +0000	[thread overview]
Message-ID: <645d17211001040535n2ad649b8l7de0e48a0873b7f8@mail.gmail.com> (raw)

A bug report was filed downstream about hexl-mode corrupting a file
during editing:

https://bugzilla.redhat.com/show_bug.cgi?id=547566

The bug report contains a recipe for reproducing the bug.

Below is a cut and paste of the original report:

Description of problem:

Using emacs hexl-mode to simply overwrite/change a few bytes in a file caused
file corruption in the saved file.  A whole line of bytes (16 bytes) went
missing from the original file.  The saved file is now 16 bytes shorter than
the original.

Version-Release number of selected component (if applicable):
23.1-7.fc11.x86_64

How reproducible:
always

Steps to Reproduce:
1. emacs emacs-hexl-before.pcap
2. M-x hexl-mode
3. Move cursor to byte 0x20 (1st one in 3rd line)
4. Edit byte 0x20 to be 0x64: C-M-x.  In the Hex number: entry, type 64
5. Edit byte 0x21 to be 0x01: C-M-x.  In the Hex number: entry, type 01
6. Move cursor to byte 0x24
7. Edit byte 0x24 to be 0x64: C-M-x.  In the Hex number: entry, type 64
8. Edit byte 0x25 to be 0x01: C-M-x.  In the Hex number: entry, type 01
9. Move cursor to byte 0x38
10. Edit byte 0x38 to be 0x01: C-M-x.  In the Hex number: entry, type 01
11. Edit byte 0x39 to be 0x56: C-M-x.  In the Hex number: entry, type 56
12. Move cursor to byte 0x40
13. Edit byte 0x40 to be 0x79: C-M-x.  In the Hex number: entry, type 79
14. Edit byte 0x41 to be 0x98: C-M-x.  In the Hex number: entry, type 98
15. Move cursor to byte 0x4e
16. Edit byte 0x4e to be 0x01: C-M-x.  In the Hex number: entry, type 01
17. Edit byte 0x4f to be 0x42: C-M-x.  In the Hex number: entry, type 42
18. Edit byte 0x50 to be 0xfb: C-M-x.  In the Hex number: entry, type fb
19. Edit byte 0x51 to be 0x24: C-M-x.  In the Hex number: entry, type 24
20. Save file: C-x C-w emacs-hexl-after.pcap
21. hexdump -C -v emacs-hexl-before.pcap > emacs-hexl-before.hex
22. hexdump -C -v emacs-hexl-after.pcap > emacs-hexl-after.hex
23. diff -ub emacs-hexl-before.hex emacs-hexl-after.hex

Actual results:

Comparing the original file to the edited file, the expected changes have been
made however additionally bytes 0x60-0x6f went missing and the original bytes
starting from 0x70 have been shifted down to position 0x60.  I.e. 16 bytes from
0x60-0x6f have been deleted and the remainder of the file shifted down.  The
saved file is also exactly 16 bytes shorter than the original.  Thus the file
has become corrupted.

Expected results:

No truncation/corruption of the file when editing bytes in-place.







             reply	other threads:[~2010-01-04 13:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <f7ccd24b1001140639n381d61a6s4fa301ef2cdc05f8@mail.gmail.com>
2010-01-04 13:35 ` Jonathan Underwood [this message]
2010-01-14  0:50   ` bug#5313: editing files in hexl-mode corrupts file Juanma Barranquero
2010-01-14 13:36     ` Jonathan Underwood
2010-01-14 14:40   ` bug#5313: marked as done (editing files in hexl-mode corrupts file) Emacs bug Tracking System
     [not found]   ` <handler.5313.D5313.12634799922391.notifdone@debbugs.gnu.org>
2010-01-14 14:51     ` bug#5313: closed by Juanma Barranquero <lekktu@gmail.com> (Re: bug#5313: editing " Jonathan Underwood
2010-01-14 16:00       ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=645d17211001040535n2ad649b8l7de0e48a0873b7f8@mail.gmail.com \
    --to=jonathan.underwood@gmail.com \
    --cc=5313@debbugs.gnu.org \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.