bugGNU Octave - Bugs: bug #48080, file_in_loadpath fails after saving


bug #48080: file_in_loadpath fails after saving

Submitted by:  Rik <rik5>
Submitted on:  Wed 01 Jun 2016 04:24:10 PM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev 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.


Tue 21 Jun 2016 02:57:06 PM UTC, comment #4:

It does seem like it would be a good idea. How major a change is this likely to be?

In load-path.cc for the update function called by rehash I see

I don't like the look of the comment. But it does appear that loader_map is a std::map which means it should be easy to add a new key/val pair. I think load-path.h needs to expose a new form of add() which takes a filename, rather than a directory as is done currently.

Rik <rik5>
Project Administrator
Tue 21 Jun 2016 09:04:05 AM UTC, comment #3:

Note that explicitly updating the hash table after all file-creation events would also solve bug #31080.

Lachlan Andrew <lachlan>
Thu 02 Jun 2016 12:51:06 AM UTC, comment #2:

Pantxo, Rik said that "pause" does not fix the issue.

I think that is because the ageing of files (and seemingly also directories) only checks for existence if the file has not been accessed since the last command line was processed. Rehash bypasses that ageing process, but pause doesn't alter the timestamp of the last command line.

Rik's problem could be fixed if save/fopen/hgsave/imwrite etc add the file to the hash table explicitly. That would be faster than a complete rehash of the whole load path.

Lachlan Andrew <lachlan>
Wed 01 Jun 2016 09:48:47 PM UTC, comment #1:


hgsave is not needed, saving data files or creating a file in a script/function is enough to trigger the bug, e.g:

It is not a duplicate but resembles bug #40319. Besides "pause", "rehash" also fixes the issue.

Pantxo Diribarne <pantxo>
Project Member
Wed 01 Jun 2016 04:24:10 PM UTC, original submission:

Run the attached script tst_hgsave.m under Octave.

The script is

The file foo.var is created by hgsave, but file_in_loadpath fails to detect it. However, once Octave has returned to a command prompt, file_in_loadpath is accurate.

Putting in a pause(1) statement after the hgsave and before the call to file_in_loadpath does not make this work. However, putting in a keyboard statement which forces a return to a debug prompt does make it work.

Rik <rik5>
Project Administrator


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

Attach Files:

Attached Files
file #37336:  tst_hgsave.m added by rik5 (185B - d2l/unknowntype)


Depends on the following items: None found

Items that depend on this one: None found


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

    Date Changed by Updated Field Previous Value => Replaced by
    2016-06-21 rik5 StatusNone => Confirmed
    2016-06-01 pantxo Summaryfile_in_loadpath fails after hgsave => file_in_loadpath fails after saving
    2016-06-01 rik5 Attached File- => Added tst_hgsave.m, #37336

    Back to the top

    Powered by Savane 3.3