Subject: bug#13743: 24.2.93; Segmentation fault when trying to [s]teal a file opened elsewhere

From: Dmitry Gutov <[email-masked]>
Date: Thu, 21 Feb 2013 12:30:24 +0400

On 20.02.2013 23:31, Eli Zaretskii wrote:
> Thanks.  This shows quite a different story.  But the backtrace alone
> is not enough to figure out what goes wrong in this scenario and why,
> at least not for me (and I don't see anyone else jumping in to dig
> into this problem).  And since reproducing this involves tricky

Thanks for looking into this, but I'd like to emphasize that so far I've 
only seen this bug on GNU/Linux.

> non-default setup and an external package, I wonder if you could
> provide a recipe starting with "emacs -Q" or with a minimal .emacs
> init file, and show every command you type to reproduce the crash?

Here's the recipe:

1. Have case2.html.erb saved somewhere (attached). The contents of the 
file are somewhat important, and also its length: if I delete the 
"sparta" line - no bug.

2. Check out this repository: https://github.com/purcell/mmm-mode

2. Open the test file in some Emacs instance, make a modification 
(prepend the first line with some spaces, for example). Don't save it.

3. Open a new Emacs instance (-Q). I'd recommend doing it with branch 
emacs-24, since trunk currently has some problems with font-lock 
(Bug#13751).

4. Paste the following into *scratch* and evaluate it:

(add-to-list 'load-path "path/to/mmm-mode")

(require 'mmm-auto)
(require 'mmm-erb)

(setq mmm-global-mode 'auto)

(mmm-add-mode-ext-class 'html-erb-mode "\\.html\\.erb\\'" 'erb)
(mmm-add-mode-ext-class 'html-erb-mode nil 'html-js)
(mmm-add-mode-ext-class 'html-erb-mode nil 'html-css)

(add-to-list 'auto-mode-alist '("\\.html\\.erb\\'" . html-erb-mode))

5. Open the test file, it will tell you that the file is locked.

6. Press `s' or `p'. See it crash.