You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When the script referenced by an env._.source field changes, the environment doesn't update, even though the sourced script definitely gets re-executed.
To Reproduce
This appears to be order dependent so make sure to follow these steps exactly as so:
$ env | grep added-in
$ cd ..
$ cd mise_bug
$ env | grep added-in
Expected behavior
Before add_to_env.sh exists, there should be a "No such file or directory" error. $ADDED_IN_MISE_TOML should be set, but $ADDED_IN_SOURCED_FILE should not, and $PATH should be untouched.
After add_to_env.sh is created, the output from that script ("In add_to_env.sh: ...") should appear, $ADDED_IN_SOURCED_FILE should be set in the shell environment, and $PATH should have a prefix added. Changing out and back into the directory should have no effect.
Actual behavior
Indeed, after .mise.toml is created but before add_to_env.sh exists, everything is as expected:
/usr/bin/bash: line 1: /home/egnor/mise_bug/add_to_env.sh: No such file or directory
mise +ADDED_IN_MISE_TOML
$ env | grep added-in
ADDED_IN_MISE_TOML=added-in-mise-toml
/usr/bin/bash: line 1: /home/egnor/mise_bug/add_to_env.sh: No such file or directory
However, after creating add_to_env.sh, things are strange:
In add_to_env.sh: ADDED_IN_SOURCED_FILE=added-in-sourced-file
In add_to_env.sh: PATH=added-in-sourced-file:[... the normal PATH ...]
$ env | grep added-in
ADDED_IN_MISE_TOML=added-in-mise-toml
So even though the script is clearly run (per the In add_to_env.sh: ... lines), $ADDED_IN_SOURCED_FILE is not set and $PATH is not modified. Upon changing out and back in, things change a bit:
$ cd ..
$ cd mise_bug
In add_to_env.sh: ADDED_IN_SOURCED_FILE=added-in-sourced-file
In add_to_env.sh: PATH=added-in-sourced-file:[... the normal PATH ...]
mise +ADDED_IN_MISE_TOML +ADDED_IN_SOURCED_FILE
In add_to_env.sh: ADDED_IN_SOURCED_FILE=added-in-sourced-file
In add_to_env.sh: PATH=added-in-sourced-file:[... the normal PATH ...]
$ env | grep added-in
ADDED_IN_MISE_TOML=added-in-mise-toml
ADDED_IN_SOURCED_FILE=added-in-sourced-file
In add_to_env.sh: ADDED_IN_SOURCED_FILE=added-in-sourced-file
In add_to_env.sh: PATH=added-in-sourced-file:[... the normal PATH ...]
So now the script is being run twice (for some reason) and this time $ADDED_IN_SOURCED_FILEis being set, but $PATH is still not being updated even though the script changes it.
Additional context
I believe this also happens if the sourced script is modified to change which variables are exported, not just when it was missing and is created, but I haven't explored all the permutations.
The text was updated successfully, but these errors were encountered:
this may be the root cause why the "short circuiting" logic isn't working in #1617. I have not investigated but I suspect the short circuiting logic is still incorrectly calling the env var directives are being executed somewhere.
Describe the bug
When the script referenced by an
env._.source
field changes, the environment doesn't update, even though the sourced script definitely gets re-executed.To Reproduce
This appears to be order dependent so make sure to follow these steps exactly as so:
(press control-D, then continue:)
(control-D again, then:)
Expected behavior
Before
add_to_env.sh
exists, there should be a "No such file or directory" error.$ADDED_IN_MISE_TOML
should be set, but$ADDED_IN_SOURCED_FILE
should not, and$PATH
should be untouched.After
add_to_env.sh
is created, the output from that script ("In add_to_env.sh: ...") should appear,$ADDED_IN_SOURCED_FILE
should be set in the shell environment, and$PATH
should have a prefix added. Changing out and back into the directory should have no effect.Actual behavior
Indeed, after
.mise.toml
is created but beforeadd_to_env.sh
exists, everything is as expected:However, after creating
add_to_env.sh
, things are strange:So even though the script is clearly run (per the
In add_to_env.sh: ...
lines),$ADDED_IN_SOURCED_FILE
is not set and$PATH
is not modified. Upon changing out and back in, things change a bit:So now the script is being run twice (for some reason) and this time
$ADDED_IN_SOURCED_FILE
is being set, but$PATH
is still not being updated even though the script changes it.mise doctor
outputAdditional context
I believe this also happens if the sourced script is modified to change which variables are exported, not just when it was missing and is created, but I haven't explored all the permutations.
The text was updated successfully, but these errors were encountered: