bugGNU Octave - Bugs: bug #45209, "echo on all" doesn't...

 
 

bug #45209: "echo on all" doesn't indent functions

Submitted by:  Mike Miller <mtmiller>
Submitted on:  Fri 29 May 2015 03:48:58 AM UTC  
 
Category: InterpreterSeverity: 2 - Minor
Priority: 1 - LaterItem Group: Other
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.

 

(Jump to the original submission Jump to the original submission)

Wed 05 Jul 2017 07:49:19 PM UTC, comment #7:

Oops, I forgot to include the changeset IDs. They are:

http://hg.savannah.gnu.org/hgweb/octave/rev/b40b7243a782
http://hg.savannah.gnu.org/hgweb/octave/rev/06b3d1d54054
http://hg.savannah.gnu.org/hgweb/octave/rev/85f1d31956c0

John W. Eaton <jwe>
Project Administrator
Wed 05 Jul 2017 07:47:55 PM UTC, comment #6:

I just checked in a series of changes that completely rework the implementation of echo. Now the text comes directly from the source file (or command-line text) instead of being recreated from the parse tree. Also, the text will appear only when commands are actually executing from a file and may be enabled or disabled from within functions.

I'm closing this report since now there is no indenting to do -- the text is just the source code, as it appears when Octave reads and parses it.

If there are additional problems with echo, please open a new bug report.

John W. Eaton <jwe>
Project Administrator
Thu 28 Jan 2016 05:30:19 PM UTC, comment #5:

I lowered the priority even further to "1 - Later". I don't mind leaving it in since it is something that someone, someday, might want to fix.

Rik <rik5>
Project Administrator
Mon 25 Jan 2016 03:44:18 AM UTC, comment #4:

Thanks for that patch Rik.

Just as a reference point, I was recently using "echo on all" to debug a case where a variable mysteriously disappeared. I wasn't at all bothered by the lack of indent.

Might I suggest a "Won't fix" / "closed" setting? (I'm trying to stop the number of open bugs reaching 1000 :)

Lachlan Andrew <lachlan>
Project Member
Sun 22 Nov 2015 04:13:02 PM UTC, comment #3:

I pushed a small fix which avoids the assertion crash here (http://hg.savannah.gnu.org/hgweb/octave/rev/771d9fab5c24)

It would still be nice to get the sequence correct so that functions are indented correctly with "echo on all", but I'm not sure that this feature is used all that much.

I've re-titled this bug report and lowered the priority and severity.

Rik <rik5>
Project Administrator
Sun 22 Nov 2015 04:09:24 AM UTC, comment #2:

Apparently this has never worked correctly, although it didn't segfault. The problem seems to be that curr_print_indent_level is not correctly incremented after the printing of the function header. You can see this because all of the function body is at the same level of indent--that is 0--during the echoing. It is only when another keyword which would increase indent, such as an 'if' statement, is encountered that the indent is increased.

I've attached pack2.m which is the file that I have been using for testing. I instrumented the code in pt-pr-code.cc and I can see that the code path is probably not what was expected. It seems that the path begins in ov-usr-fcn.cc in do_multi_index_op where print_code_function_header is called. This, in turn, calls visit_octave_user_function_header in pt-pr-code.cc. From reading the code in pt-pr-code.cc, it looks like the intended path may have been to call visit_octave_user_function(). That function in turn calls visit_octave_user_function_header() but it also has the code to call increment_indent_level().

Just to see if there was an easy fix, I added a call to increment_indent_level() at the end of visit_octave_user_function_header(). This correctly does the increment, but the next time the indent() function is called the value is back to 0. I think this may be because the original call back in ov-usr-fcn.cc is sitting in an unwind/protect frame. If that is the case, I'm not quite sure how to fix this crash.

I've added jwe to the CC list of the bug since this bug is beyond me.

Here is the test sequence I used.

(file #35518)

Rik <rik5>
Project Administrator
Sat 30 May 2015 09:31:48 PM UTC, comment #1:

I bisected and found the cause of this crash to be the recent change for bug #40462:

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

Part of this change moved where decrement_indent_level() is called so it is no longer strictly paired with increment_indent_level(), and somehow that is now allowing the indent level to go negative when ECHO_FUNCTIONS is used.

This does not impact the 4.0 stable branch.

Mike Miller <mtmiller>
Project Administrator
Fri 29 May 2015 03:48:58 AM UTC, original submission:

Octave's parser panics and crashes when "echo on all" is used to display the contents of m-file functions as they are executed. Example with pack, which is a trivial noop function:

Mike Miller <mtmiller>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #35518:  pack2.m added by rik5 (97B - d2l/unknowntype)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by lachlan (Posted a comment)
  • -unavailable- added by rik5 (Updated the item)
  • -unavailable- added by rik5
  • -unavailable- added by mtmiller (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 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 05 Jul 2017 07:47:55 PM UTCjweStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 28 Jan 2016 05:30:19 PM UTCrik5Priority3 - Low=>1 - Later
    Sun 22 Nov 2015 04:13:02 PM UTCrik5Severity4 - Important=>2 - Minor
      Priority5 - Normal=>3 - Low
      Item GroupSegfault, Bus Error, etc.=>Other
      Summaryparser assertion failure and crash when "echo on all" is used=>"echo on all" doesn't indent functions
    Sun 22 Nov 2015 04:09:24 AM UTCrik5Attached File-=>Added pack2.m, #35518
    Sun 22 Nov 2015 03:04:39 AM UTCrik5Carbon-Copy-=>Added jwe
    Sat 30 May 2015 09:31:48 PM UTCmtmillerSeverity3 - Normal=>4 - Important
      StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1