Add a New Comment (Rich Markup)
Lowering the priority. This is mostly a nuisance. The suggestion by jwe to search the cache first, but then verify the result, would work. However, at that point one is presumably calling stat() on the file. Wouldn't it be simpler to do away with the cache itself then since regardless of hit you would need to call stat? That would be a big step and I'm not really proposing to do it, but it does seem like a lot of advantages would be lost.
I think the problem is that info about directories in teh load path is cached and the cache is updated when Octave issues a prompt and also when a few other events happen, like adding a new directory to the path. The case of removing a file from a directory in the path hasn't been handled. But even if we fix unlink to refresh the cached load path info when removing a file from a directory that is in the load path, we could still have problems with other things like
system ("rm -f /tmp/x")
and there's really no way to know. So maybe a better approach would just be to first look in the cache for files (for speed) and then verify that the file found from the cache actually does exist before returning success?
Confirmed on the default branch here also. Not so much about timing, this also shows the same error:
>> x = 0; >> save x x >> unlink ("x"); sleep (10); fd = fopen ("x", "rb") warning: fopen: '/tmp/x' found by searching load path fd = -1
This looks like some timing problem. Run this in the CLI
fn = "foo.log"; save (fn, "fn");
and then paste to CLI in one line OR create a script file and run it (it will not show the warning if unlink and fopen are run separately)
>> unlink (fn); fid = fopen (fn, 'rb') warning: fopen: '/home/andy/temp/foo.log' found by searching load path fid = -1
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
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 project members can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 5 latest changes.
Copyright © 2023 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.11