[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs crashes with eval-region and marker

From: Kim F. Storm
Subject: Re: emacs crashes with eval-region and marker
Date: Fri, 08 Apr 2005 01:08:56 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

address@hidden (Mario Domgörgen) writes:

> This bug report will be sent to the Free Software Foundation,
> not to your local site managers!
> Please write in English if possible, because the Emacs maintainers
> usually do not have translators to read other languages for them.
> Your bug report will be posted to the address@hidden mailing list.
> Please describe exactly what actions triggered the bug
> and the precise symptoms of the bug:
> I start a clean emacs with emacs -q --no-init-file and evaluate
> the following function:
> (defun html-eval-scripts ()
>   (interactive)
>   (save-excursion
>     (goto-char (point-min))
>     (while (re-search-forward
>               "<script.*type=\"text/elisp\">\\(.*\\)</script>" nil t)
>       (eval-region (match-beginning 1)(match-end 1) (point-marker)))))
> When i call html-eval-scripts on a buffer with a line like this
> <script type="text/elisp">(insert "Hallo bold world")</script>
> Emacs crashed with "Fatal error (6).Abort". This seems to happen with
> all emacs i have emacs20,emacs21 and several cvs versions.

Problem is that you end up calling eval-region like this:

 (eval-region 27 54 <#marker at 67>)

In Feval_region, we have this code:

  /* This both uses start and checks its type.  */
  Fgoto_char (start);
  Fnarrow_to_region (make_number (BEGV), end);
  readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval,
                !NILP (printflag), Qnil, read_function);

which means that we narrow the region to [1..54] around the
call to readevalloop -- which will eventually call Fprint
with Vstandard_output set to the <#marker>.

Fprint uses PRINTPREPARE which will try to set point at the marker

   if (MARKERP (printcharfun))                                          \
     {                                                                  \
       SET_PT_BOTH (marker_position (printcharfun),                     \
                    marker_byte_position (printcharfun));               \

But that position is _outside_ the narrow region, so it traps in

  /* Check this now, before checking if the buffer has any intervals.
     That way, we can catch conditions which break this sanity check
     whether or not there are intervals in the buffer.  */
  if (charpos > BUF_ZV (buffer) || charpos < BUF_BEGV (buffer))
    abort ();

That's the analysis -- I'm not sure how to fix the problem.

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]