waitbar() crashing when used from within emacs

View: New views
6 Messages — Rating Filter:   Alert me  

waitbar() crashing when used from within emacs

by Thomas Weber-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

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
Emacs.

        Thomas




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: waitbar() crashing when used from within emacs

by Thomas Weber-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[cc'ing Quentin, maybe he has an idea]

Am Donnerstag, den 12.06.2008, 12:44 +0200 schrieb Thomas Weber:

> Hi,
>
> 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
> Emacs.
>
> Thomas



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: waitbar() crashing when used from within emacs

by Quentin Spencer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas Weber wrote:

> Am Donnerstag, den 12.06.2008, 12:44 +0200 schrieb Thomas Weber:
>  
>> Hi,
>>
>> 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
>> Emacs.
>>
>> Thomas
>>    


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.

Quentin


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

[patch] Re: waitbar() crashing when used from within emacs

by Thomas Weber-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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:
>>  
>>> Hi,
>>>
>>> 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
>>> Emacs.
>>>
>>> Thomas
>>>    
>
>
> 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).

        Thomas

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: [patch] Re: waitbar() crashing when used from within emacs

by Thomas Weber-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Sonntag, den 22.06.2008, 22:06 +0200 schrieb Thomas Weber:
> 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).

Hm, maybe one day I'll remember that SF strips attachments; patch
available at
http://www.tw-math.de/~weber/octave-forge/waitbar-crash.diff

        Thomas


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: [patch] Re: waitbar() crashing when used from within emacs

by David Bateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas Weber wrote:
> Hm, maybe one day I'll remember that SF strips attachments; patch
> available at
> http://www.tw-math.de/~weber/octave-forge/waitbar-crash.diff
>
>  

Applied.

D.



--
David Bateman                                David.Bateman@...
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

The information contained in this communication has been classified as:

[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev