Summary
bin/activate.fish appends a bogus ^/dev/null element to PATH. Every
fish user of nodeenv gets it. The same one-line bug also defeats the stderr
suppression the line was written for.
Reproduction
$ nodeenv --prebuilt /tmp/ne
$ fish -c 'source /tmp/ne/bin/activate.fish; string join \n $PATH | tail -1'
^/dev/null
Observed in CI on ubuntu-latest as a fourth PATH entry resolving to
<cwd>/^/dev/null.
Cause
ACTIVATE_FISH ends its PATH line with a caret redirect:
# The node_modules/.bin path doesn't exists and it will print a warning, and
# that's why we redirect stderr to /dev/null :)
set -gx PATH "$NODE_VIRTUAL_ENV/lib/node_modules/.bin" "$NODE_VIRTUAL_ENV/__BIN_NAME__" $PATH ^/dev/null
fish 3.0 introduced the stderr-nocaret feature flag and ^ stopped being
a stderr redirect; it is now an ordinary character. So ^/dev/null is
parsed as one more argument to set and lands in PATH.
Two consequences, not one:
PATH gains an entry that does not exist.
- The warning the redirect was meant to hide now reaches stderr, so the
comment above the line no longer describes what happens.
nodeenv.py uses the same ^/dev/null syntax once more, inside freeze:
set -g NPM_LIST (npm list installed active >/dev/null ^/dev/null | \
cut -d ' ' -f 1 | grep -v npm)
Both should be fixed together. The modern spelling is 2>/dev/null.
Test coverage
tests/test_activate_shells.py (added in #397) marks this
xfail(strict=True) as FISH_CARET_REDIRECT on test_activate_sets_env,
via the path_shell decorator. When the fix lands, drop the constant and the
decorator and put the test back on @activating_shell.
Worth noting how it surfaced: the test originally asserted only the first two
PATH entries, which hid this completely and let CI report green. Widening
it to compare the whole list caught the bug on the first run. A regression
anywhere past index 1 was previously invisible.
Summary
bin/activate.fishappends a bogus^/dev/nullelement toPATH. Everyfish user of nodeenv gets it. The same one-line bug also defeats the stderr
suppression the line was written for.
Reproduction
Observed in CI on
ubuntu-latestas a fourthPATHentry resolving to<cwd>/^/dev/null.Cause
ACTIVATE_FISHends itsPATHline with a caret redirect:fish 3.0 introduced the
stderr-nocaretfeature flag and^stopped beinga stderr redirect; it is now an ordinary character. So
^/dev/nullisparsed as one more argument to
setand lands inPATH.Two consequences, not one:
PATHgains an entry that does not exist.comment above the line no longer describes what happens.
nodeenv.pyuses the same^/dev/nullsyntax once more, insidefreeze:Both should be fixed together. The modern spelling is
2>/dev/null.Test coverage
tests/test_activate_shells.py(added in #397) marks thisxfail(strict=True)asFISH_CARET_REDIRECTontest_activate_sets_env,via the
path_shelldecorator. When the fix lands, drop the constant and thedecorator and put the test back on
@activating_shell.Worth noting how it surfaced: the test originally asserted only the first two
PATHentries, which hid this completely and let CI report green. Wideningit to compare the whole list caught the bug on the first run. A regression
anywhere past index 1 was previously invisible.