bugGNU Octave - Bugs: bug #55888, running rmdir() in unsaved script...

 
 

bug #55888: running rmdir() in unsaved script in GUI editor causes tab to be closed or saved

Submitted by:  Mike Miller <mtmiller>
Submitted on:  Tue 12 Mar 2019 01:33:46 AM UTC  
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  Torsten Lilge <ttl>
Originator Name:  Open/Closed:  Closed
Release:  5.1.0 Operating 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)

Thu 14 Mar 2019 12:25:59 AM UTC, comment #13:

Yes, I don't do it often, but I think you'd update to the stable branch and use 'hg graft -r 9fa577cf9f4e' to copy it over.

Mike Miller <mtmiller>
Project Administrator
Wed 13 Mar 2019 10:54:54 PM UTC, comment #12:

Fix works on Windows a well.

There's still bug #55883 that looks very similar.

Philip Nienhuis <philipnienhuis>
Project Member
Wed 13 Mar 2019 07:16:53 PM UTC, comment #11:

Yes, I think the patch is safe enough to go into the stable branch. This is "hg graft", right?

Torsten Lilge <ttl>
Project MemberIn charge of this item.
Wed 13 Mar 2019 06:01:38 PM UTC, comment #10:

Do you think this is important enough and small enough to push to the stable branch too?

Mike Miller <mtmiller>
Project Administrator
Wed 13 Mar 2019 06:00:41 PM UTC, comment #9:

Thank you, fixed for me now.

Mike Miller <mtmiller>
Project Administrator
Wed 13 Mar 2019 05:40:54 AM UTC, comment #8:

I have pushed cset http://hg.savannah.gnu.org/hgweb/octave/rev/9fa577cf9f4e which fixes the issue for new, unnamed tabs.

@Mike: Indeed, it was in handle_dir_remove where empty file names where considered as contained in the directory to be removed. This patch will most probably not fix the issue on windows where also regular files are closed in the editor.

Torsten Lilge <ttl>
Project MemberIn charge of this item.
Wed 13 Mar 2019 12:17:23 AM UTC, comment #7:

Bug #55823 is a similar bug, seemingly also triggered by 'rmdir' closing files in the editor, even if they are saved, but only manifests on Windows.

You probably already found this, but it looks to me like the logic in the 'file_editor::handle_dir_remove' function is incorrectly deciding that the open tab lives under the directory that was rmdir'd. Maybe on Windows this also needs to account for backslash directory separators?

Mike Miller <mtmiller>
Project Administrator
Tue 12 Mar 2019 09:41:49 PM UTC, comment #6:

I guess I found the issue, patch will follow.

Torsten Lilge <ttl>
Project MemberIn charge of this item.
Tue 12 Mar 2019 08:06:20 PM UTC, comment #5:

Definitely one of my patches for closing tabs related to files removed from within octave introduced this issue. I will have a closer look into this.

Torsten Lilge <ttl>
Project MemberIn charge of this item.
Tue 12 Mar 2019 07:57:37 PM UTC, comment #4:

I think this is related to bug #43922 and revision d3c6de326bae, which added some link to the GUI on the 'rmdir' command.

Mike Miller <mtmiller>
Project Administrator
Tue 12 Mar 2019 07:53:25 PM UTC, comment #3:

Oopsie, that should read "bug #55823, comment #22".

Philip Nienhuis <philipnienhuis>
Project Member
Tue 12 Mar 2019 07:44:27 PM UTC, comment #2:

See bug #55823, comment #21.
Just repeating: this got introduced between July 31 and August 6 of last summer.

Philip Nienhuis <philipnienhuis>
Project Member
Tue 12 Mar 2019 07:29:12 PM UTC, comment #1:

This bug happens because the 'file_editor_tab::file_has_changed' slot is being called even when the editor tab does not have a file name. The '_file_name' member variable is an empty string, 'file_exists' is false, and '_edit_area->isModified ()' returns true.

There's a lot going on in that slot, but is the purpose of that function only to handle the case when a file on disk is modified outside of the Octave editor? If so, then should that slot simply return immediately if '_file_name' is empty and just leave things alone? Or will that break some other case, like exiting Octave or closing the tab?

Cc'ing Torsten.

Mike Miller <mtmiller>
Project Administrator
Tue 12 Mar 2019 01:33:46 AM UTC, original submission:

Pasting the following into a new blank tab in the GUI editor

dn = tempname ();
mkdir (dn);
rmdir (dn);

selecting all lines, and running the selection with "Run Selection" or F9, causes Octave to prompt for the editor tab to be closed or saved as a new file when it gets to the 'rmdir' function call. This is a regression from Octave 4.4 where it worked fine, the unsaved file stays open in the editor and the lines are executed as expected in the command window.

Screenshot from Octave 5.1.0 showing the prompt attached. The prompt seems to say that Octave thinks a file has been deleted, but there was never a file associated with the tab to begin with.

Mike Miller <mtmiller>
Project Administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #46502:  octave-close-rmdir.png added by mtmiller (34KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by mtmiller
  •  

    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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-13 mtmiller StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2019-03-13 ttl StatusIn Progress => Ready For Test
    2019-03-12 ttl StatusConfirmed => In Progress
        Assigned toNone => ttl
    2019-03-12 mtmiller StatusNone => Confirmed
    2019-03-12 mtmiller Carbon-Copy- => Added ttl
    2019-03-12 mtmiller Carbon-CopyRemoved 80942 => -
    2019-03-12 mtmiller Attached File- => Added octave-close-rmdir.png, #46502

    Back to the top


    Powered by Savane 3.4