bugGNU Octave - Bugs: bug #52274, Segfault when calling previously...

 
 

bug #52274: Segfault when calling previously used oct-file from deleted directory

Submitted by:  Piotr Held <jsoh425>
Submitted on:  Tue 24 Oct 2017 04:52:25 PM UTC  
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Piotr Held Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Mon 31 Dec 2018 12:56:10 AM UTC, comment #4: 

I tested as well and this throws a lot of error messages, but no longer segfaults.  Given that the directory really is missing, I think the warnings are legitamate and there is nothing else we need to do.  Marking bug as fixed and closing report.

Rik <rik5>
Project Administrator
Sun 30 Dec 2018 08:29:47 PM UTC, comment #3: 

With a current build of stable (74368b4f9d8c) I get

octave:4> helloworld
warning: load_path: oct_test: Datei oder Verzeichnis nicht gefunden
warning: load-path: update failed for 'oct_test', removing from path
warning: load_path: oct_test: Datei oder Verzeichnis nicht gefunden
warning: load-path: update failed for 'oct_test', removing from path
warning: load_path: oct_test: Datei oder Verzeichnis nicht gefunden
warning: load-path: update failed for 'oct_test', removing from path
error: 'helloworld' undefined near line 1 column 1

Andreas Weber <andy1978>
Project Member
Tue 24 Oct 2017 08:34:53 PM UTC, comment #2: 

The cause seems to be an infinite loop until eventually there is an overflow in memory.  I ran with gdb and the stack trace was over 30,000 deep.  The beginning of the infinite loop is shown below.

#30748 0x00007f66a2a43a2f in octave::symbol_table::find_function (this=0xb51508, name="helloworld", args=...,
    local_funcs=true) at libinterp/corefcn/symtab.cc:1392
#30749 0x00007f66a25307b5 in get_user_code (fname="helloworld") at libinterp/parse-tree/bp-table.cc:101
#30750 0x00007f66a253342e in bp_table::do_remove_all_breakpoints_in_file (this=0x108baa0, fname="helloworld", silent=true)
    at libinterp/parse-tree/bp-table.cc:764
#30751 0x00007f66a2535072 in bp_table::remove_all_breakpoints_in_file (fname="helloworld", silent=true)
    at libinterp/parse-tree/bp-table.h:99
#30752 0x00007f66a2a3f28c in octave::out_of_date_check (function=..., dispatch_type="", check_relative=true)
    at libinterp/corefcn/symtab.cc:486
#30753 0x00007f66a2a42795 in octave::symbol_table::fcn_info::fcn_info_rep::find_user_function (this=0xf81d70)
    at libinterp/corefcn/symtab.cc:1200
#30754 0x00007f66a2a3fd38 in octave::symbol_table::fcn_info::fcn_info_rep::load_class_constructor (this=0xf81d70)
    at libinterp/corefcn/symtab.cc:576
#30755 0x00007f66a2a414db in octave::symbol_table::fcn_info::fcn_info_rep::xfind (this=0xf81d70, args=..., local_funcs=true)
    at libinterp/corefcn/symtab.cc:928
#30756 0x00007f66a2a40e1d in octave::symbol_table::fcn_info::fcn_info_rep::find (this=0xf81d70, args=..., local_funcs=true)
    at libinterp/corefcn/symtab.cc:808
#30757 0x00007f66a2a47d4f in octave::symbol_table::fcn_info::find (this=0xf3a990, args=..., local_funcs=true)
    at libinterp/corefcn/symtab.h:1020
#30758 0x00007f66a2a449eb in octave::symbol_table::scope::find (this=0xb52ac0, name="helloworld", args=...,
    skip_variables=true, local_funcs=true) at libinterp/corefcn/symtab.cc:1569
#30759 0x00007f66a2a43733 in octave::symbol_table::find (this=0xb51508, name="helloworld", args=..., skip_variables=true,
    local_funcs=true) at libinterp/corefcn/symtab.cc:1358
#30760 0x00007f66a2a43a2f in octave::symbol_table::find_function (this=0xb51508, name="helloworld", args=...,
    local_funcs=true) at libinterp/corefcn/symtab.cc:1392
#30761 0x00007f66a25307b5 in get_user_code (fname="helloworld") at libinterp/parse-tree/bp-table.cc:101
#30762 0x00007f66a253342e in bp_table::do_remove_all_breakpoints_in_file (this=0x108baa0, fname="helloworld", silent=true)
    at libinterp/parse-tree/bp-table.cc:764
#30763 0x00007f66a2535072 in bp_table::remove_all_breakpoints_in_file (fname="helloworld", silent=true)
    at libinterp/parse-tree/bp-table.h:99
#30764 0x00007f66a2a3f28c in octave::out_of_date_check (function=..., dispatch_type="", check_relative=true)
    at libinterp/corefcn/symtab.cc:486
#30765 0x00007f66a2a42795 in octave::symbol_table::fcn_info::fcn_info_rep::find_user_function (this=0xf81d70)
    at libinterp/corefcn/symtab.cc:1200
#30766 0x00007f66a2a3fd38 in octave::symbol_table::fcn_info::fcn_info_rep::load_class_constructor (this=0xf81d70)
    at libinterp/corefcn/symtab.cc:576
#30767 0x00007f66a2a414db in octave::symbol_table::fcn_info::fcn_info_rep::xfind (this=0xf81d70, args=..., local_funcs=true)
    at libinterp/corefcn/symtab.cc:928
#30768 0x00007f66a2a40e1d in octave::symbol_table::fcn_info::fcn_info_rep::find (this=0xf81d70, args=..., local_funcs=true)
    at libinterp/corefcn/symtab.cc:808
#30769 0x00007f66a2a47d4f in octave::symbol_table::fcn_info::find (this=0xf3a990, args=..., local_funcs=true)
    at libinterp/corefcn/symtab.h:1020
#30770 0x00007f66a2a449eb in octave::symbol_table::scope::find (this=0xb52ac0, name="helloworld", args=...,
    skip_variables=true, local_funcs=true) at libinterp/corefcn/symtab.cc:1569
#30771 0x00007f66a2a43733 in octave::symbol_table::find (this=0xb51508, name="helloworld", args=..., skip_variables=true,
    local_funcs=true) at libinterp/corefcn/symtab.cc:1358
#30772 0x00007f66a2a43a2f in octave::symbol_table::find_function (this=0xb51508, name="helloworld", args=...,
    local_funcs=true) at libinterp/corefcn/symtab.cc:1392
#30773 0x00007f66a2a3e4af in octave::symbol_table::symbol_record::find (this=0xede040, args=...)
    at libinterp/corefcn/symtab.cc:241
#30774 0x00007f66a259bc4e in octave::tree_identifier::do_lookup (this=0xede020, args=...)
    at libinterp/parse-tree/pt-id.h:100
#30775 0x00007f66a259225e in octave::tree_evaluator::visit_index_expression (this=0xb515e0, idx_expr=...)
    at libinterp/parse-tree/pt-eval.cc:1243
#30776 0x00007f66a25b3294 in octave::tree_index_expression::accept (this=0xf40b50, tw=...)
    at libinterp/parse-tree/pt-idx.h:101
#30777 0x00007f66a23f9cf1 in octave::tree_evaluator::evaluate (this=0xb515e0, expr=0xf40b50, nargout=0)
    at libinterp/parse-tree/pt-eval.h:271
#30778 0x00007f66a2596e27 in octave::tree_evaluator::visit_statement (this=0xb515e0, stmt=...)
    at libinterp/parse-tree/pt-eval.cc:2211
#30779 0x00007f66a25bc7d2 in octave::tree_statement::accept (this=0xf2cbe0, tw=...) at libinterp/parse-tree/pt-stmt.h:112
#30780 0x00007f66a2596fd7 in octave::tree_evaluator::visit_statement_list (this=0xb515e0, lst=...)
    at libinterp/parse-tree/pt-eval.cc:2253
#30781 0x00007f66a23fa166 in octave::tree_statement_list::accept (this=0xd053b0, tw=...)
    at libinterp/parse-tree/pt-stmt.h:187
#30782 0x00007f66a28dc8aa in octave::interpreter::main_loop (this=0xb51230) at libinterp/corefcn/interpreter.cc:974
#30783 0x00007f66a28db546 in octave::interpreter::execute (this=0xb51230) at libinterp/corefcn/interpreter.cc:695
#30784 0x00007f66a1fe79b1 in octave::cli_application::execute (this=0x7ffe2dc8c2f0) at libinterp/octave.cc:384
#30785 0x00000000004017a0 in main (argc=8, argv=0x7ffe2dc8c5f8) at src/main-cli.cc:90

The first block that starts to repeat begins with this

#30688 0x00007f66a2a43a2f in octave::symbol_table::find_function (this=0xb51508, name="helloworld", args=...,
    local_funcs=true) at libinterp/corefcn/symtab.cc:1392

Rik <rik5>
Project Administrator
Tue 24 Oct 2017 08:28:03 PM UTC, comment #1: 

Confirmed.  It is not enough to delete the file helloworld.oct, it has to be the directory.

Also, it seems to be a general problem with the path not necessarily related to trying to execute the .oct file.  After deleting the temporary directory I tried

which helloworld

and that also caused a segfault.

Rik <rik5>
Project Administrator
Tue 24 Oct 2017 04:52:25 PM UTC, original submission:  

The scenario is as follows:

1. Open Octave in a directory (let's call it 'test').
2. Put an oct-file (e.g. helloworld.oct from the documentation) in a subdir (let's call it 'oct_test', so the path to it is 'test/oct_test')
3. From octave do:

>>pwd
/some/path/to/test
>>addpath oct_test
>>helloworld
Hello World has 0 input arguments and 0 output arguments.
# Now delete the oct_test folder
>>helloworld
warning: load_path: oct_test: No such file or directory
Segmentation fault

This problem also is true when working with .mex files.

Piotr Held <jsoh425>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jsoh425 (Submitted the item)
  •  

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

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-31 rik5 StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2017-10-24 rik5 Carbon-Copy- => Added jwe
    2017-10-24 rik5 StatusNone => Confirmed

    Back to the top


    Powered by Savane 3.5