[Pkg-octave-devel] Bug#485920: [patch] Re: waitbar() crashing when used from within emacs
thomas.weber.mail at gmail.com
Sun Jun 22 20:06:10 UTC 2008
On 20/06/08 10:17 -0500, Quentin Spencer wrote:
> Thomas Weber wrote:
>> Am Donnerstag, den 12.06.2008, 12:44 +0200 schrieb Thomas Weber:
>>> starting an octave-inferior process within Emacs and then using the
>>> waitbar function from miscellaneous crashes octave:
>>> octave> waitbar(0)
>>> panic: Segmentation fault -- stopping myself...
>>> attempting to save variables to `octave-core'...
>>> save to `octave-core' complete
>>> Process Inferior Octave segmentation fault
>>> The crash happens in line 150 where buf_ptr is a null pointer. The
>>> problematic part is however in line 147 already, where tgetstr() returns
>>> 0. Excerpt from tgetstr()'s man page:
>>> "The tgetstr routine returns the string entry for id, or zero if it is
>>> not available."
>>> I don't know if it's possible to change waitbar() to work from within
> It has been a long time since I wrote this. If I recall correctly, the
> purpose of this was to get the width of the terminal, which apparently
> does not work inside emacs. The fix is probably to deal with zero output
> correctly, probably just forcing it to use the parts of the code where
> it defaults to some fixed width if it can't figure out how wide it
> should be.
I took a closer look at the code. The part in question implements a progress
bar by switching into standout mode (tgetstr("so", &buf_ptr);) and back out
from standout mode (tgetstr("se", &buf_ptr);)
Emacs doesn't seem to handle this, but as there is a progress reporter in
percent, the attached patch simply protects the null pointer dereference (the
patch looks bigger than it is, as I adjusted the indendation accordinly).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 868 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-octave-devel/attachments/20080622/997fdd0c/attachment.diff
More information about the Pkg-octave-devel