all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5313: editing files in hexl-mode corrupts file
@ 2010-01-04 13:35 ` Jonathan Underwood
  2010-01-14  0:50   ` Juanma Barranquero
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jonathan Underwood @ 2010-01-04 13:35 UTC (permalink / raw)
  To: bug-gnu-emacs

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.







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

* bug#5313: editing files in hexl-mode corrupts file
  2010-01-04 13:35 ` bug#5313: editing files in hexl-mode corrupts file Jonathan Underwood
@ 2010-01-14  0:50   ` 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>
  2 siblings, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2010-01-14  0:50 UTC (permalink / raw)
  To: Jonathan Underwood; +Cc: 5313

On Mon, Jan 4, 2010 at 14:35, Jonathan Underwood
<jonathan.underwood@gmail.com> wrote:

> A bug report was filed downstream about hexl-mode corrupting a file
> during editing:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=547566

Could you please try the following patch?

    Juanma


=== modified file 'lisp/hexl.el'
--- lisp/hexl.el	2010-01-13 08:35:10 +0000
+++ lisp/hexl.el	2010-01-14 00:38:04 +0000
@@ -779,7 +779,7 @@

 (defun hexl-printable-character (ch)
   "Return a displayable string for character CH."
-  (format "%c" (if hexl-iso
+  (format "%c" (if (not (equal hexl-iso ""))
 		   (if (or (< ch 32) (and (>= ch 127) (< ch 160)))
 		       46
 		     ch)






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

* bug#5313: editing files in hexl-mode corrupts file
  2010-01-14  0:50   ` Juanma Barranquero
@ 2010-01-14 13:36     ` Jonathan Underwood
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Underwood @ 2010-01-14 13:36 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 5313

2010/1/14 Juanma Barranquero <lekktu@gmail.com>:
> Could you please try the following patch?
>
> === modified file 'lisp/hexl.el'
> --- lisp/hexl.el        2010-01-13 08:35:10 +0000
> +++ lisp/hexl.el        2010-01-14 00:38:04 +0000
> @@ -779,7 +779,7 @@
>
>  (defun hexl-printable-character (ch)
>   "Return a displayable string for character CH."
> -  (format "%c" (if hexl-iso
> +  (format "%c" (if (not (equal hexl-iso ""))
>                   (if (or (< ch 32) (and (>= ch 127) (< ch 160)))
>                       46
>                     ch)
>

Thanks. I have pushed builds for Fedora 11 and 12 incorporating that patch.






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

* bug#5313: marked as done (editing files in hexl-mode corrupts file)
  2010-01-04 13:35 ` bug#5313: editing files in hexl-mode corrupts file Jonathan Underwood
  2010-01-14  0:50   ` Juanma Barranquero
@ 2010-01-14 14:40   ` Emacs bug Tracking System
       [not found]   ` <handler.5313.D5313.12634799922391.notifdone@debbugs.gnu.org>
  2 siblings, 0 replies; 6+ messages in thread
From: Emacs bug Tracking System @ 2010-01-14 14:40 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-bug-tracker

[-- Attachment #1: Type: text/plain, Size: 870 bytes --]

Your message dated Thu, 14 Jan 2010 15:39:23 +0100
with message-id <f7ccd24b1001140639n381d61a6s4fa301ef2cdc05f8@mail.gmail.com>
and subject line Re: bug#5313: editing files in hexl-mode corrupts file
has caused the Emacs bug report #5313,
regarding editing files in hexl-mode corrupts file
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact bug-gnu-emacs@gnu.org
immediately.)


-- 
5313: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5313
Emacs Bug Tracking System
Contact bug-gnu-emacs@gnu.org with problems

[-- Attachment #2: Type: message/rfc822, Size: 6908 bytes --]

From: Jonathan Underwood <jonathan.underwood@gmail.com>
To: bug-gnu-emacs@gnu.org
Subject: editing files in hexl-mode corrupts file
Date: Mon, 4 Jan 2010 13:35:46 +0000
Message-ID: <645d17211001040535n2ad649b8l7de0e48a0873b7f8@mail.gmail.com>

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.




[-- Attachment #3: Type: message/rfc822, Size: 3274 bytes --]

From: Juanma Barranquero <lekktu@gmail.com>
To: Jonathan Underwood <jonathan.underwood@gmail.com>
Cc: 5313-done@debbugs.gnu.org
Subject: Re: bug#5313: editing files in hexl-mode corrupts file
Date: Thu, 14 Jan 2010 15:39:23 +0100
Message-ID: <f7ccd24b1001140639n381d61a6s4fa301ef2cdc05f8@mail.gmail.com>

On Thu, Jan 14, 2010 at 14:36, Jonathan Underwood
<jonathan.underwood@gmail.com> wrote:

> Thanks. I have pushed builds for Fedora 11 and 12 incorporating that patch.

I've installed in the trunk a slight variation of this patch (same
change, but the if/else parts inverted to avoid "(if (not (equal".

    Juanma


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

* bug#5313: closed by Juanma Barranquero <lekktu@gmail.com> (Re: bug#5313: editing files in hexl-mode corrupts file)
       [not found]   ` <handler.5313.D5313.12634799922391.notifdone@debbugs.gnu.org>
@ 2010-01-14 14:51     ` Jonathan Underwood
  2010-01-14 16:00       ` Chong Yidong
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Underwood @ 2010-01-14 14:51 UTC (permalink / raw)
  To: 5313

2010/1/14 Emacs bug Tracking System <bug-gnu-emacs@gnu.org>:
> I've installed in the trunk a slight variation of this patch (same
> change, but the if/else parts inverted to avoid "(if (not (equal".
>
>    Juanma

Might be a good idea to push it to the 23.2 branch too, if possible.






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

* bug#5313: closed by Juanma Barranquero <lekktu@gmail.com> (Re: bug#5313: editing files in hexl-mode corrupts file)
  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
  0 siblings, 0 replies; 6+ messages in thread
From: Chong Yidong @ 2010-01-14 16:00 UTC (permalink / raw)
  To: Jonathan Underwood; +Cc: 5313

Jonathan Underwood <jonathan.underwood@gmail.com> writes:

> Might be a good idea to push it to the 23.2 branch too, if possible.

Trunk will become 23.2.






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

end of thread, other threads:[~2010-01-14 16:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <f7ccd24b1001140639n381d61a6s4fa301ef2cdc05f8@mail.gmail.com>
2010-01-04 13:35 ` bug#5313: editing files in hexl-mode corrupts file Jonathan Underwood
2010-01-14  0:50   ` 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

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.