bugGNU Octave - Bugs: bug #31286, octave crash after paste

 
 

bug #31286: octave crash after paste

Submitted by:  Kai Habel <kahacjde>
Submitted on:  Sat 09 Oct 2010 12:59:45 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 15 Dec 2010 08:15:55 AM UTC, comment #4:

I believe this problem is fixed by the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/b2191ebea12f

See also https://savannah.gnu.org/bugs/index.php?31861

John W. Eaton <jwe>
Project Administrator
Sat 09 Oct 2010 08:14:53 PM UTC, comment #3:

After thinking about it some more, I doubt that the patch I posted is sufficient. What if a function registered with input_event_hook needs to be parsed (or, causes some other function to be parsed) when we are already parsing another function? I think that will cause trouble because Octave's parser is not reentrant. It would probably take some effort to make it so. The solution is probably to somehow avoid parsing another function simultanousely, but I'm not sure precisely how to go about doing that and still have input_event_hook working correctly so that it processes graphics events (for example).

John W. Eaton <jwe>
Project Administrator
Sat 09 Oct 2010 05:54:57 PM UTC, comment #2:

I can confirm, that your patch fixes the crash, but I cannot comment on the patch itself - that is beyond my knowledge of octave.
Indeed, I was using the fltk backend.

Kai Habel <kahacjde>
Project Member
Sat 09 Oct 2010 02:32:07 PM UTC, comment #1:

I assume you found this problem with the fltk backend? I think it will also happen if there are any input_event_hook functions defined. The problem is that input_event_hook in input.cc calls feval, and if that happens when we are in the middle of parsing a function, the current symbol table scope is pushed/popped, but the parser had it temporarily set to the scope of the partially parsed function. I'm not sure whether it is appropriate to push the scope of the new partially parsed function onto the call stack, but that appears to avoid the crash. See the attached patch. But since I'm not sure about this solution and it might cause some other trouble, I'd like some feedback before committing it.

(file #21646)

John W. Eaton <jwe>
Project Administrator
Sat 09 Oct 2010 12:59:45 PM UTC, original submission:

I have:
kai@linux-nuoy:~/hg-octave/octave> hg tip
Änderung: 11091:5677f3f7b5fa
Marke: tip
Nutzer: John W. Eaton <jwe@octave.org>
Datum: Fri Oct 08 15:22:47 2010 -0400
Zusammenfassung: Matlab compatible short-circuit behavior for & and | operators

When I call ./run-octave -g and try to paste the folling code:

function myfun
figure(1)
set(1,'windowbuttondownfcn','grid')
end

I get the following crash:

octave:1> function myfun

> figure(1)
> set(1,'windowbuttondownfcn','grid')
> end

octave: symtab.h:1837: static void symbol_table::set_curr_fcn(octave_user_function*, symbol_table::scope_id): Assertion `scope != xtop_scope && scope != xglobal_scope' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff15039e5 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff15039e5 in raise () from /lib64/libc.so.6
#1 0x00007ffff1504ee6 in abort () from /lib64/libc.so.6
#2 0x00007ffff14fc235 in __assert_fail () from /lib64/libc.so.6
#3 0x00007ffff751ecb6 in set_curr_fcn (this=0x6a9138, sid=1, pl=0x0, rl=0x0, cl=<value optimized out>) at symtab.h:1837
#4 octave_user_function::octave_user_function (this=0x6a9138, sid=1, pl=0x0, rl=0x0, cl=<value optimized out>)
at ov-usr-fcn.cc:193
#5 0x00007ffff72d72d4 in start_function (param_list=0x0, body=0xd01720, end_fcn_stmt=<value optimized out>)
at oct-parse.yy:2814
#6 0x00007ffff72e291c in octave_parse () at oct-parse.yy:1412
#7 0x00007ffff73c234c in main_loop () at toplev.cc:564
#8 0x00007ffff735ab0f in octave_main (argc=6, argv=<value optimized out>, embedded=0) at octave.cc:884
#9 0x00007ffff14efb7d in __libc_start_main () from /lib64/libc.so.6
#10 0x0000000000400739 in _start () at ../sysdeps/x86_64/elf/start.S:113
(gdb)

Kai Habel <kahacjde>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #21646:  diffs.txt added by jwe (3KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by kahacjde (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 15 Dec 2010 08:15:55 AM UTCjweStatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Sat 09 Oct 2010 02:32:07 PM UTCjweAttached File-=>Added diffs.txt, #21646
      StatusNone=>Patch Submitted

    Back to the top


    Powered by Savane 3.1-cleanup1