bugGNU Octave - Bugs: bug #49171, Warnings after save from GUI...


bug #49171: Warnings after save from GUI editor are related to the previous version

Submitted by:  Avinoam Kalma <avinoam>
Submitted on:  Fri 23 Sep 2016 09:06:58 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  4.2.0-rc2 Operating System:  Any

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)

Wed 09 Nov 2016 05:15:28 AM UTC, comment #12: 

I have this change on the dev branch, and it works fine.

Good job!

Avinoam Kalma <avinoam>
Project Member
Tue 08 Nov 2016 08:11:46 PM UTC, comment #11: 

There must be a difference in compilers.  I changed the code to

if ((Fisdebugmode ())(0).is_true ()

and checked it in on the stable branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/4678729e8ae1).

Rik <rik5>
Project Administrator
Tue 08 Nov 2016 07:26:41 PM UTC, comment #10: 

I was just about to submit and almost identical patch. However, mine was slightly different because it doesn't seem my compile allows the comparison of octave_value_list and bool

libgui/src/m-editor/file-editor-tab.cc:1846:11: error: value of type 'octave_value_list' is not contextually convertible to 'bool'
      if (Fisdebugmode () &&
libgui/src/m-editor/file-editor-tab.cc:1846:27: error: invalid operands to binary expression ('octave_value_list' and 'bool')
      if (Fisdebugmode () &&

I will still attach my diff, but the difference was that I used

Fisdebugmode () (0).bool_value () == true


(file #38907)

John Swensen <jpswensen>
Tue 08 Nov 2016 07:13:21 PM UTC, comment #9: 

I've submitted a patch which applies against stable which appears to solve this problem, while still maintaining the fix for bug #46632).  It's not perfect, I sometimes get multiple warning about not being able to parse the file if there is an error in it and you are in debug mode, but it still seems better than the current behavior.

Can John or Avinoam test immediately?  jwe is planning to make the rc4 candidate today and this could go in if it is verified in time.

(file #38906)

Rik <rik5>
Project Administrator
Tue 08 Nov 2016 06:56:40 PM UTC, comment #8: 

As to comment #6:
I find that in debug mode (= when any breakpoints have been set and the function is executing), Octave always asks to quit debugging when I press the Save button. This is with octave-4.3.0+ on Windows.

I do find that removal of breakpoints using the relevant menu bar buttons is not completely robust. But that is another story.

Philip Nienhuis <philipnienhuis>
Project Member
Tue 08 Nov 2016 06:06:28 PM UTC, comment #7: 

There is at least a quick way to check whether Octave is in debug mode with the isdebugmode() command.  From a C++ file, this could be called with

if (Fisdebugmode ())

I don't know which part of the code you need to wrap with the if statement to make this work.

Rik <rik5>
Project Administrator
Tue 08 Nov 2016 05:59:53 PM UTC, comment #6: 

I think a quick fix may be as easy as checking whether the file has any breakpoints and whether Octave is currently in debug mode before causing the exit_debug_and_clear to be called. I think that in Matlab that if you are trying to save a file while debugging that it asks if you want to stop debugging and save the file. I think this keeps Matlab from having to reparse any files until the next time they are run.

So, an alternative workaround to Bug #46632 is to ask if the user want to stop debugging (assuming Octave is in debug mode) when a save is requested. Additionally, this would prevent the need to re-parse until the next time the function is run.

John Swensen <jpswensen>
Tue 08 Nov 2016 05:15:39 PM UTC, comment #5: 

I added a dependency on bug #46632 and put a note about this bug on that report.  Hopefully someone from that report or this report will have insight into the issue.

Rik <rik5>
Project Administrator
Tue 08 Nov 2016 04:49:02 PM UTC, comment #4: 

I have hunted down what is causing this, but don't enough about the interaction between the gui and the core of Octave to know the right way to fix it.

The error is occurring in class method


at the line

sym = symbol_table::find (base_name);

It appears that trying to find the symbol associated with the file causes the file to be re-parsed. Since the parsing fails, then the file save fails.

This is called from


at the lines

      // Force reparse of this function next time it is used (bug #46632)
      if (!exit_debug_and_clear (file_to_save, file_info.baseName ()))

It appears this was introduced by http://hg.savannah.gnu.org/hgweb/octave/rev/acdd8983d308 in response to Bug #46632 (see https://savannah.gnu.org/bugs/?func=detailitem&item_id=46632#options)

John Swensen <jpswensen>
Tue 11 Oct 2016 08:23:03 PM UTC, comment #3: 

I removed MXE from the Summary, and changed the OS to Any, since this also occurs on Linux.

Rik <rik5>
Project Administrator
Sat 24 Sep 2016 09:07:49 PM UTC, comment #2: 

Maybe related (?)

When I save file with parse errors from the GUI editor, the parse error messages show up in the terminal (fine), but I have to press <RETURN> to get back a prompt.
When I don't do that, the terminal is dysfunctional. I can enter commands but they can't be executed.

Repeatedly saving the fixed file indeed repeats the parse errors that were already fixed, until <RETURN> is entered - at that moment it seems the file is re-parsed?

Philip Nienhuis <philipnienhuis>
Project Member
Sat 24 Sep 2016 12:06:20 AM UTC, comment #1: 

Confirmed.  It's weird.  Just saving a file shouldn't cause a full parse of the function.  I tried inserting 'clear -f' after making the change to the file name and saving--hoping that it would clear out the existing function from the symbol table--but it didn't work.

Rik <rik5>
Project Administrator
Fri 23 Sep 2016 09:06:58 PM UTC, original submission:  

Example 1:

1. Creating a file names "foo.m"

function foo
  disp ('foo);

2. Using the "save as" command to save this file as "foo1.m"
3. Using the editor to change the function name to "foo1"
4. Saving the file. I get a warning:

>> warning: function name 'foo' does not agree with function filename 'D:\Octave\BUGS\foo1.m'

Example 2:

Creating a file names "foo1.m" with an error

function foo1
  disp ('foo'))));

fixing the error and saving the file I get

>> parse error near line 2 of file D:\Octave\BUGS\foo1.m

  syntax error

>>>   disp ('foo'))));


This error is marked "regression" because it did not appear in 4.0.3

Avinoam Kalma <avinoam>
Project Member


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

Attach Files:

Attached Files
file #38907:  only_reparse_if_in_debug.diff added by jpswensen (652B - application/octet-stream)
file #38906:  49171.cset added by rik5 (1KiB - application/octet-stream)


   bug dependencies.

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5
  • -email is unavailable- added by jpswensen (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by avinoam (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-08 rik5 StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2016-11-08 jpswensen Attached File- => Added only_reparse_if_in_debug.diff, #38907
    2016-11-08 rik5 Attached File- => Added 49171.cset, #38906
        StatusConfirmed => Patch Submitted
        Carbon-Copy- => Added jwe
    2016-11-08 rik5 Dependencies- => Depends on bugs #46632
    2016-10-11 rik5 Operating SystemMicrosoft Windows => Any
        SummaryMXE Octave: Warnings after save are related to the previous version => Warnings after save from GUI editor are related to the previous version
    2016-09-24 rik5 StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.7