Subject: Re: Bug#696026: emacs24: file corruption on saving

From: Rob Browning <[email-masked]>
Date: Sat, 19 Jan 2013 22:09:28 -0600

(If possible, please preserve the *-forwarded address in any replies.)

The following bug was reported to Debian.  I've tested both the Debian
emacs24 package, and current upstream emacs-24, as of:

  Author: Leo Liu <[email-masked]>
  Date:   Sat Jan 19 02:35:44 2013 +0800

    Prune erroneous values in dired-get-marked-files

In both cases, I was able to reproduce the reported issue.

Please let me know if I can provide further information.

Vincent Lefevre <[email-masked]> writes:

> Package: emacs24
> Version: 24.2+1-1
> Severity: grave
> Justification: causes non-serious data loss
>
> The file "file1" (attached) has the following contents:
>
> 00000000  6c e2 80 99 c3 a9 0a 74  65 73 74 e9 0a           |l......test..|
>
> 1. Open "file1" with "emacs -Q". It is regarded as
>    an in-is13194-devanagari-unix file.
>
> 2. Type M-: (set-buffer-modified-p t) to mark the buffer as modified
>    (so that one can save it).
>
> 3. Save the file with C-x C-s. It is proposed:
>
> [...]
> Select one of the safe coding systems listed below,
> or cancel the writing with C-g and edit the buffer
>    to remove or modify the problematic characters,
> or specify any other coding system (and risk losing
>    the problematic characters).
>
>   raw-text emacs-mule no-conversion
>
> 4. Choose raw-text (the default) or no-conversion. One can assume
>    that the file will not be modified. But it gets corrupted: one
>    obtains a file "file2" (attached) with the following contents:
>
> 00000000  6c e0 a5 88 80 99 e0 a4  a5 e0 a4 8a 0a 74 65 73  |l............tes|
> 00000010  74 e0 a4 bc 0a                                    |t....|
>
> Note: Actually "file1" has mixed UTF-8 and ISO-8859-1 contents due to
> a user error. But due to this bug, an attempt to fix the problem with
> Emacs makes things even worse! BTW, I had the same problem in the past
> when attempting to edit an mbox file with Emacs (in this case, having
> mixed UTF-8 and ISO-8859-1 contents is normal). How Emacs interprets
> such contents doesn't matter, but by default, it mustn't corrupt the
> file on saving.
>
> There is no such problem with GNU Emacs 23.4.1 (Debian package
> emacs23 23.4+1-4).
>
> -- System Information:
> Debian Release: 7.0
>   APT prefers unstable
>   APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
> Architecture: amd64 (x86_64)
>
> Kernel: Linux 3.5-trunk-amd64 (SMP w/2 CPU cores)
> Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
>
> Versions of packages emacs24 depends on:
> ii  emacs24-bin-common  24.2+1-1
> ii  gconf-service       3.2.5-1+build1
> ii  libasound2          1.0.25-4
> ii  libatk1.0-0         2.4.0-2
> ii  libc6               2.13-37
> ii  libcairo2           1.12.2-2
> ii  libdbus-1-3         1.6.8-1
> ii  libfontconfig1      2.9.0-7.1
> ii  libfreetype6        2.4.9-1
> ii  libgconf-2-4        3.2.5-1+build1
> ii  libgdk-pixbuf2.0-0  2.26.1-1
> ii  libgif4             4.1.6-10
> ii  libglib2.0-0        2.33.12+really2.32.4-3
> ii  libgnutls26         2.12.20-2
> ii  libgomp1            4.7.2-4
> ii  libgpm2             1.20.4-6
> ii  libgtk2.0-0         2.24.10-2
> ii  libice6             2:1.0.8-2
> ii  libjpeg8            8d-1
> ii  libm17n-0           1.6.3-2
> ii  libmagickcore5      8:6.7.7.10-5
> ii  libmagickwand5      8:6.7.7.10-5
> ii  libncurses5         5.9-10
> ii  libotf0             0.9.12-2
> ii  libpango1.0-0       1.30.0-1
> ii  libpng12-0          1.2.49-3
> ii  librsvg2-2          2.36.1-1
> ii  libselinux1         2.1.9-5
> ii  libsm6              2:1.2.1-2
> ii  libtiff4            3.9.6-9
> ii  libtinfo5           5.9-10
> ii  libx11-6            2:1.5.0-1
> ii  libxft2             2.3.1-1
> ii  libxml2             2.8.0+dfsg1-7
> ii  libxpm4             1:3.5.10-1
> ii  libxrender1         1:0.9.7-1
> ii  zlib1g              1:1.2.7.dfsg-13
>
> emacs24 recommends no packages.
>
> Versions of packages emacs24 suggests:
> ii  emacs24-common-non-dfsg  24.2+1-1
>
> -- no debconf information

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4