Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

activate.fish leaves a literal ^/dev/null entry in PATH

未关闭 适合新手
#400 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
fish, python
领域
cli, testing-qa

调研方向

检查 ACTIVATE_FISH 模板和 nodeenv.py 中的第二条 fish 命令;两者都使用 ^/dev/null。然后阅读 tests/test_activate_shells.py,移除 FISH_CARET_REDIRECT 的 xfail 设置,并恢复 @activating_shell。完成标准是两个重定向都使用现代写法,并且完整的 PATH 断言在没有虚假条目的情况下通过。

由索引模型根据 Issue 内容生成。

描述

bug

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:

  1. PATH gains an entry that does not exist.
  2. 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.

主要语言
Python
星标
1.8k
派生
224
平均合并
10 小时 15 分钟
30 天内合并 PR
22

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ekalinin/nodeenv 的其他 Issue

查看 ekalinin/nodeenv 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。