Subject: insert-file-contents-literally + md5 unstable in multibyte buffers

From: Stefan Monnier <[email-masked]>
Date: Wed, 12 Mar 2008 12:10:27 -0400

Package: Emacs
Version: 23.0.60
Owner: Kenichi Handa <[email-masked]>

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Run emacs -Q and then in the *scratch* buffer do:

   M-: (progn (erase-buffer )
              (insert-file-contents-literally
                "/usr/lib/clisp-2.43/full/regexp.dvi")
              (md5 (current-buffer)))

Do it a few times: you should see that you do not always get the
same result.  If you do not have that dvi file, try with another one,
preferably not tiny ones.

If you rerun only the md5 call, you'll get the same result each time, so
it seems that md5 is looking at data that insert-file-contents-literally
does not always set up in the same way.  Maybe an off-by-one somewhere
that causes md5 to look at bytes within the gap or something?

If this is run in a unibyte buffer, the problem disappears.

        Stefan

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/home/monnier/src/emacs/work/etc/DEBUG for instructions.

In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2008-03-12 on pastel
Windowing system distributor `The X.Org Foundation', version 11.0.10300000
configured using `configure  'CFLAGS=-Wall -DSYNC_INPUT -DENABLE_CHECKING -g -O2' 'CPPFLAGS=-I/home/monnier/src/Xaw3d' 'LDFLAGS=-L/home/monnier/src/Xaw3d' '--with-x-toolkit=athena' '--enable-font-backend''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_CH.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: minibuffer

Minor modes in effect:
  url-handler-mode: t
  global-reveal-mode: t
  reveal-mode: t
  auto-insert-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  cua-mode: t
  mouse-wheel-mode: t
  partial-completion-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
f ~ / . e m <tab> . <tab> d <tab> <tab> a <tab> <tab> 
<tab> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <tab> <tab> s e s <tab> <tab> 
6 <tab> <return> M-x d e l - f i <M-tab> <return> M-n 
<return> C-x C-v C-e <M-backspace> <M-backspace> C-/ 
<tab> <return> M-x M-p <return> M-n <return> C-x k 
<return> C-x k <return> C-x 5 0 f C-g M-x r e p o r 
t - e m <tab> <return>

Recent messages:
Loading /home/monnier/src/elisp/haskell-mode/haskell-site-file.el (source)...done
Loading /usr/share/emacs21/site-lisp/bbdb/bbdb-autoloads...done
Loading /home/monnier/src/elisp/ProofGeneral/generic/proof-site.el (source)...done
Warning: set-coding-priority is obsolete!
Loading /home/monnier/src/elisp/sml-mode/sml-mode-startup.el (source)...done
Loading /home/monnier/etc/emacs/X11.el (source)...done
Loading /home/monnier/etc/emacs/custom.el (source)...done
Starting new Ispell process [default] ...
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list... [4 times]
Quit