[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #48351] make_absolute_filename should canonica
From: |
Mike Miller |
Subject: |
[Octave-bug-tracker] [bug #48351] make_absolute_filename should canonicalize absolute filename inputs |
Date: |
Sat, 2 Jul 2016 22:40:41 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0 |
Follow-up Comment #6, bug #48351 (project octave):
Thanks! So the filesep differences are definitely not safe, my mistake.
Confirmed that there is still a problem with something like
run //tmp/foo.m
There is also a problem with running a script in a symlinked directory. Octave
reports the destination of the symlink when pwd() is run, so the name passed
in to the function does not match the pwd value after cd'ing.
How about a change like this instead of relying on directory
canonicalization:
diff --git a/scripts/miscellaneous/run.m b/scripts/miscellaneous/run.m
--- a/scripts/miscellaneous/run.m
+++ b/scripts/miscellaneous/run.m
@@ -60,14 +60,16 @@ function run (script)
if (! isempty (d))
if (exist (d, "dir"))
+ scriptdir = "";
startdir = pwd ();
d = make_absolute_filename (d);
unwind_protect
cd (d);
+ scriptdir = pwd ();
evalin ("caller", sprintf ("source ('%s%s');", f, ext),
"rethrow (lasterror ())");
unwind_protect_cleanup
- if (strcmp (d, pwd ()))
+ if (strcmp (scriptdir, pwd ()))
cd (startdir);
endif
end_unwind_protect
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?48351>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/