🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98749

emacs aborts after asking for RMAIL-summary

#98749
From: Richard Stallman
Date: Thu, 04 Apr 1991 23:52
68 lines
3351 bytes
    I've been working along the same lines: The following patch to
    buffer.c is certainly a big hammer, but it seems to work in both
    18.55 and epoch 3.2 (patchlevel 2+) with no obvious bad side
    effects.

This is a very bad idea if the aim is to make Emacs reliable.  Having
point outside the virtual buffer bounds will probably make many parts
of Emacs liable to crash.  Removing the error check does not get rid
of the problem; rather, it makes the real problem harder to find.  The
purpose of the error check is to make such bugs cause crashes sooner
and more often, because that makes it possible to fix them.

Perhaps in this particular case none of those things gets done on that
buffer before it becomes valid again.  If so, this case would not
crash without the error check.  But some other program some day would
exercise that path, resulting in crashes whose origins nobody could
understand.  This error check has made it possible to fix the bug once
and for all.

Luckily, Piet did the right thing (find where the incorrect value is
made) as well as the wrong thing (recommend taking out the error
check).  I will fix the next version of Emacs to put the pointer into
bounds in unshow-buffer.  I suggest other people install this change
in window.c instead of removing the error check.  (The first function
is new; the second, a replacement.)  Then, if there is another bug
that makes point invalid, we still have a chance of finding it.


int
clip_to_bounds (lower, num, upper)
     int lower, num, upper;
{
  if (num < lower)
    return lower;
  else if (num > upper)
    return upper;
  else
    return num;
}

/* Record info on buffer window w is displaying
   when it is about to cease to display that buffer.  */
static void
unshow_buffer (w)
     register struct window *w;
{
  register Lisp_Object buf;
  buf = w->buffer;

  if (XBUFFER (buf) != XMARKER (w->pointm)->buffer)
    abort ();

  if (w == XWINDOW (selected_window)
      || ! EQ (buf, XWINDOW (selected_window)->buffer))
    /* Do this except when the selected window's buffer
       is being removed from some other window.  */
    XBUFFER (buf)->last_window_start = marker_position (w->start);

  /* Point in the selected window's buffer
     is actually stored in that buffer, and the window's pointm isn't used.
     So don't clobber point in that buffer.  */
  if (! EQ (buf, XWINDOW (selected_window)->buffer))
    BUF_PT (XBUFFER (buf))
      = clip_to_bounds (BUF_BEGV (XBUFFER (buf)),
			marker_position (w->pointm),
			BUF_ZV (XBUFFER (buf)));
}
Technical Details
Message-ID: <9104042352.AA02796@mole.gnu.ai.mit.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!emory!samsung!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!tut.cis.ohio-state.edu!unreplyable!garbage
References: <PIERSON.91Apr4095304@xenna.encore.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,e7ddce83d77b5594
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1991-04-04 15:52:46 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!emory!samsung!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!tut.cis.ohio-state.edu!unreplyable!garbage
From: rms@GNU.AI.MIT.EDU (Richard Stallman)
Newsgroups: gnu.emacs.bug
Subject: emacs aborts after asking for RMAIL-summary
Message-ID: <9104042352.AA02796@mole.gnu.ai.mit.edu>
Date: 4 Apr 91 23:52:46 GMT
References: <PIERSON.91Apr4095304@xenna.encore.com>
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 68
Approved: bug-gnu-emacs@prep.ai.mit.edu