[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #62961] script search path seems not to update
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #62961] script search path seems not to update to current directory in a script |
Date: |
Fri, 26 Aug 2022 16:10:09 -0400 (EDT) |
URL:
<https://savannah.gnu.org/bugs/?62961>
Summary: script search path seems not to update to current
directory in a script
Project: GNU Octave
Submitter: None
Submitted: Fri 26 Aug 2022 08:10:07 PM UTC
Category: Other
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Alex Barnett
Originator Email: abarnett@flatironinstitute.org
Open/Closed: Open
Release: 6.4.0
Discussion Lock: Any
Operating System: GNU/Linux
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Fri 26 Aug 2022 08:10:07 PM UTC By: Anonymous
It seems the script search path (and I've found the mex search path too) fails
to update upon a cd when done in a script (not using the command line).
The below example should output:
ans = hello from a
ans = hello from b
It does not on my ubuntu octave 6.4.0, on ubuntu/popos 22.04. It incorrectly
produces:
ans = hello from a
ans = hello from a
Here is minimally complete example from bash:
mkdir a
cat <<EOF > a/test.m
"hello from a"
EOF
mkdir b
cat <<EOF > b/test.m
"hello from b"
EOF
cat <<EOF > bug.m
cd a; test
cd ../b; test
EOF
octave bug.m
Output:
ans = hello from a
ans = hello from a
However, opening octave and using command line (not script!)
gives expected output:
octave:2> cd a; test
ans = hello from a
octave:3> cd ../b; test
ans = hello from b
I didn't have time to look into the cause, but I *can* verify that:
1) which('test') fails to change after 2nd cd, verifying the bug,
2) pause(1) makes no difference, the bug is still there,
3) addpath(.) inserted after the 2nd cd is a workaround.
Thanks! Alex
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62961>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #62961] script search path seems not to update to current directory in a script,
anonymous <=