bugGNU Octave - Bugs: bug #40312, On MacOS X GUI asks to reload a...

 
 

bug #40312: On MacOS X GUI asks to reload a saved file

Submitter:  Ben Abbott <bpabbott>
Submitted:  Sun 20 Oct 2013 12:39:06 PM UTC
   
 
Category:  GUI Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Ben Abbott Open/Closed:  * Closed
Release:  * dev Operating System:  * Mac OS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 23 Oct 2013 07:01:50 PM UTC, comment #30: 

Works for me!

Ben Abbott <bpabbott>
Group Member
Wed 23 Oct 2013 06:57:15 PM UTC, comment #29: 

Fixed with changeset
http://hg.savannah.gnu.org/hgweb/octave/rev/d3bb7f1e3971
The only drawback is that I had to install a custom message in order to get rid of the messages, that the poller engine is used instead of the native one.

Ben, I would be glad if you could test if everything is working as expected before I close the report.

Torsten Lilge <ttl>
Group Member
Wed 23 Oct 2013 05:27:34 PM UTC, comment #28: 

The changetset below allows foo.txt to be created when "edit foo.txt" is executed and "foo.txt" does not exist.

http://hg.savannah.gnu.org/hgweb/octave/rev/6a2e483125dd



Ben Abbott <bpabbott>
Group Member
Wed 23 Oct 2013 04:44:56 PM UTC, comment #27: 

Yes. the watcher does work if I modify foo.m outside of Octave.

Ben Abbott <bpabbott>
Group Member
Wed 23 Oct 2013 04:27:17 PM UTC, comment #26: 

I am preparing a changeset that asks for creating the file and an option in the settings that files are always created without dialog.

Does the watcher with the other non-native engine work for you when you really modify a file outside octave?

Torsten Lilge <ttl>
Group Member
Wed 23 Oct 2013 11:44:48 AM UTC, comment #25: 

The "edit" command in Matlab behaves the same for all extensions (at least on MacOSX).  The one instance where m-file are treated differently is that "edit foo" and "edit foo.m" are equivalent.

Has the subject of creating new file with types  that are not .m or .cc been discussed? 

If not, might the current dialog be modified to say; `File "foo.txt" does no exist.  Would you like to create a new file?" ( Yes )    (  No  )



Ben Abbott <bpabbott>
Group Member
Wed 23 Oct 2013 04:50:04 AM UTC, comment #24: 

Then I will have a look how to get rid of the "engine" warning.

The "no such directory" issue isn't a Mac only problem (see comment #12). When in GUI mode "edit" only creates non existing .m or .cc files. Non existing files with other extensions are not created but still the editor is called.

Torsten Lilge <ttl>
Group Member
Tue 22 Oct 2013 09:07:14 PM UTC, comment #23: 

Patch 05 eliminates the modified warning.


edit foo.m
QFileSystemWatcher: skipping native engine, using only polling engine
QFileSystemWatcher: skipping native engine, using only polling engine


However, "edit foo.txt" still results in a dialog with

"Could not open file foo.txt for read: No such file or directory." (  OK  )

Is that a MacOS X only problem?

Ben Abbott <bpabbott>
Group Member
Tue 22 Oct 2013 08:53:04 PM UTC, comment #22: 

For patch 04, I encountered the error below.


src/m-editor/file-editor-tab.cc: In member function 'void file_editor_tab::set_file_name(const QString&)':
src/m-editor/file-editor-tab.cc:184:11: error: 'sleep' was not declared in this scope


Ben Abbott <bpabbott>
Group Member
Tue 22 Oct 2013 08:29:57 PM UTC, comment #21: 

The MacOSX file system may be cacheing files in some manner.  I am also using Apple's TimeMachine backup feature, but that shouldn't be changing the modification date.

I'll try each patch are report back in separate comments.

Ben Abbott <bpabbott>
Group Member
Tue 22 Oct 2013 07:46:07 PM UTC, comment #20: 

The results are looking reasonable. At least we know now that the file watcher triggers the signal some time after the file was added to the tracking-list (in set_file_name) and not at the same moment. This looks like the files are written to the disc with a delay or something changes some file attributes after the file was written.

Do you have tools running that might cause this? Does a virus scanner set file attributes after checking the file during the write process?

To test if it is a timing issue, could you please test the attached patch 04?
The second patch 05 configures an alternative engine of the watcher. Please use the patches separately.

Sorry for flooding you with patches but I still have no specific clue.

(file #29445, file #29446)

Torsten Lilge <ttl>
Group Member
Tue 22 Oct 2013 01:06:09 PM UTC, comment #19: 

Regarding changes, I had troubles building the gui over the last year.  Each time this occurred a solution was quickly provided.

Unfortunately, that makes bisecting difficult.

Ben Abbott <bpabbott>
Group Member
Tue 22 Oct 2013 12:24:14 PM UTC, comment #18: 


>> edit foo.m
>>
=====================
load_file (begin)
=====================
>>> File: foo.m
>>> Tracked Files: 0
>>> Tracker Events: 0

=====================
set_file_name (begin)
=====================
>>> File: /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracked Files: 0
>>> Tracker Events: 0

=====================
set_file_name (end)
=====================
>>> File: /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracked Files: 1
    /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracker Events: 0

=====================
load_file (end)
=====================
>>> File: /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracked Files: 1
    /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracker Events: 0

=====================
file_has_changed
=====================
>>> File: /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracked Files: 1
    /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracker Events: 1


If I then modify foo.m and save it,


=====================
save_file (begin)
=====================
>>> File: /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracked Files: 1
    /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracker Events: 1

=====================
set_file_name (begin)
=====================
>>> File: /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracked Files: 0
>>> Tracker Events: 1

=====================
set_file_name (end)
=====================
>>> File: /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracked Files: 1
    /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracker Events: 1

=====================
save_file (end)
=====================
>>> File: /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracked Files: 1
    /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracker Events: 1

=====================
file_has_changed
=====================
>>> File: /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracked Files: 1
    /Users/bpabbott/Development/mercurial/new-default/sources/foo.m
>>> Tracker Events: 2


Ben Abbott <bpabbott>
Group Member
Tue 22 Oct 2013 07:26:10 AM UTC, comment #17: 

Please find attach a patch that prints several infos into the console. Could you please send me the printed information for the two cases

1. edit foo.m
2. saving a modified editor file?



(file #29439)

Torsten Lilge <ttl>
Group Member
Tue 22 Oct 2013 04:44:32 AM UTC, comment #16: 

Were there any changes on your system that may be related to the problem during this time?

Torsten Lilge <ttl>
Group Member
Tue 22 Oct 2013 02:16:07 AM UTC, comment #15: 

The furthest back I've been able to build the gui is 16638:3c2e457eeb72.  Unfortunately, I encounter the same problem.

Ben Abbott <bpabbott>
Group Member
Tue 22 Oct 2013 01:02:29 AM UTC, comment #14: 

I should mention that this problem wasn't present a few months back.  Unfortunately, I haven't tested the GUI often enough to give an estimate more accurate than that.

I suppose I should attempt a bisect.

Ben Abbott <bpabbott>
Group Member
Mon 21 Oct 2013 08:07:20 PM UTC, comment #13: 

The 3rd patch also has no effect on the warnings :-(

I get the modified-waring when saving an edited file and when creating a new file with "edit foo.m". But not when I load a file via the open file dialog.

As you wrote, "edit foo.m" creates the file in the current directory.  If the docs indicate otherwise, my understanding is that they are wrong for the GUI.  If my memory is correct, this had been discussed on the list and we agreed that the file should be created in the pwd().  I do not recall what was decided should be done for the CLI version of Octave.

In any event, I have the following line in my octaverc file.


edit editinplace true


Thus, non-existant files are created for me in the pwd() when running the CLI version as well.

Ben Abbott <bpabbott>
Group Member
Mon 21 Oct 2013 07:53:50 PM UTC, comment #12: 

Well, I am running out of ideas. Here is another patch that completely resets the file-watcher when saving or loading a file. Are there any changes with it?

To summarize: You get the modified-waring when saving an edited file and when creating a new file with "edit foo.m".
But not when you a re loading a file via the open file dialog?

The "edit foo.txt" issue also shows up for me. When in gui-mode edit.m does apparently not create the file in the home directory as indicated in the docs but only calls the editor with its filename. I will file another bug report for this later.

Btw: the file foo.m is created by "edit foo.m" but in the current directory instead of the home directory (as indicated in the docs, too). Can you confirm this on your system?



(file #29437)

Torsten Lilge <ttl>
Group Member
Mon 21 Oct 2013 01:18:56 PM UTC, comment #11: 

With the patch applied, "edit foo.m" (non-existing foo.m) still results in the modified-warning.

And "edit foo.txt" (also non-existing foo.txt) still results in file-not-found warning.


Ben Abbott <bpabbott>
Group Member
Mon 21 Oct 2013 02:53:15 AM UTC, comment #10: 

Ben, could you please test another patch (attached)?

(file #29433)

Torsten Lilge <ttl>
Group Member
Sun 20 Oct 2013 08:16:33 PM UTC, comment #9: 

The file "foo.m" does not exist with I try "edit foo.m".  I assume the modified-warning occurs when the file is initially created.

Ben Abbott <bpabbott>
Group Member
Sun 20 Oct 2013 07:25:20 PM UTC, comment #8: 

Ben, you get this modified-warning with "edit foo.m" and not only when saving a file in the editor?
Does foo.m already exist when "edit foo.m" is evaluated (or is maybe already opened in the editor)?

Torsten Lilge <ttl>
Group Member
Sun 20 Oct 2013 06:39:06 PM UTC, comment #7: 

With "97ed9dd479ab tip @" I see no change in behavior.

"edit foo.m" results in a dialog with

"It seems that `foo.m' has been modified by another application. Do you want to reload it?"

"edit foo.txt" results in a dialog with

"Could not open file foo.txt for read: No such file or directory"

Ben Abbott <bpabbott>
Group Member
Sun 20 Oct 2013 06:26:38 PM UTC, comment #6: 

Maybe related: When a file in the actual directory was created by


edit foo.m


its entry in the mru-menu only has the file name without path. This leads to en error if the menu is used within another directory or when the editor session is restored at next startup.

I have pushed changeset
http://hg.savannah.gnu.org/hgweb/octave/rev/97ed9dd479ab
that ensures absolute paths in the mru menu and in the file watcher.
Ben, could you please check what happens on your system after this changeset?

In the case


edit foo.txt


I suppose no file is created (in contrast to *.m files) and the editor tries to load an non-existing file. Therefore, this is the expected behavior.

Torsten Lilge <ttl>
Group Member
Sun 20 Oct 2013 03:17:43 PM UTC, comment #5: 

Opps. You are correct.  "edit foo.txt" does not work, but "edit foo.m" does work.

In the latter case, creating the new file produces a dialog containing

"It seems that `/Users/<snip>...</snip>/the_file_name.m' has been modified by another application. Do you want to reload it?"

Ben Abbott <bpabbott>
Group Member
Sun 20 Oct 2013 01:41:48 PM UTC, comment #4: 

Strange, the patch should not affect the problem editing a new file ...

Torsten Lilge <ttl>
Group Member
Sun 20 Oct 2013 01:27:22 PM UTC, comment #3: 

I can now edit a new file, but the original problem persists.

"It seems that `/Users/<snip>...</snip>/the_file_name.m' has been modified by another application. Do you want to reload it?"

Ben Abbott <bpabbott>
Group Member
Sun 20 Oct 2013 01:07:18 PM UTC, comment #2: 

Ben, could you please try the attached patch?

(file #29428)

Torsten Lilge <ttl>
Group Member
Sun 20 Oct 2013 12:58:31 PM UTC, comment #1: 

If a file does not exist, the edit command produces a dialog containing the error message below


Could not open file the_file_name.suffix for read: No such file or directory


Ben Abbott <bpabbott>
Group Member
Sun 20 Oct 2013 12:39:06 PM UTC, original submission:  

When I (1) edit a file (m-file, text file, etc) in the GUI, (2) modify the file, (3) save the file, I'm asked


It seems that `/Users/<snip>...</snip>/the_file_name.m' has been modified by another application. Do you want to reload it?



Ben Abbott <bpabbott>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #29445:  bug_40312_p04.diff added by ttl (492B - text/x-diff)
file #29446:  bug_40312_p05.diff added by ttl (491B - text/x-diff)
file #29439:  debug_40312_01.diff added by ttl (3KiB - text/x-diff)
file #29437:  bug_40312_p03.diff added by ttl (5KiB - text/x-diff)
file #29433:  bug_40312_p02.diff added by ttl (1KiB - text/x-diff)
file #29428:  bug_40312_p01.diff added by ttl (786B - text/x-diff)
file #29427:  Screen Shot 2013-10-20 at 8.32.09 AM.png added by bpabbott (52KiB - image/png - modal dialog window)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ttl (Updated the item)
  • -email is unavailable- added by bpabbott (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-23 ttl StatusNone Fixed
        Open/ClosedOpen Closed
    2013-10-22 bpabbott SummaryGUI asks to reload a saved file On MacOS X GUI asks to reload a saved file
    2013-10-22 ttl Attached File- Added bug_40312_p04.diff, #29445
        Attached File- Added bug_40312_p05.diff, #29446
    2013-10-22 ttl Attached File- Added debug_40312_01.diff, #29439
    2013-10-21 ttl Attached File- Added bug_40312_p03.diff, #29437
    2013-10-21 ttl Attached File- Added bug_40312_p02.diff, #29433
    2013-10-20 ttl Attached File- Added bug_40312_p01.diff, #29428
    2013-10-20 bpabbott Attached File- Added Screen Shot 2013-10-20 at 8.32.09 AM.png, #29427

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code