User fish functions named like built-ins break the vp wrapper and vpr completion in env.fish
Maintainer thường phản hồi trong vòng 1 ngày
@naokihaba đang làm issue này rồi.
Từ ngày 19/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Describe the bug
The generated env.fish calls some fish built-in commands by their bare names. These commands are count, math, contains, complete, and commandline. fish looks for a function before a built-in. fish also autoloads a function from ~/.config/fish/functions/<name>.fish when a script first calls the name. Thus, if a user has a function with one of these names, env.fish calls the user's function and not the built-in.
fish still starts and shows no error. But the vp wrapper and the vpr completion work incorrectly.
| User function | Result |
|---|---|
count |
vp env use 20.18.0 shows Using Node.js v20.18.0, but VP_NODE_VERSION stays unset. The wrapper does not find env use, so it does not eval the output of vp. |
math |
vp -C <dir> env use 20.18.0 does not set VP_NODE_VERSION. The wrapper calculates a wrong position for the command after -C. |
complete |
env.fish does not register the vpr completion. |
commandline |
The vpr completer cannot read the command line. It ignores -C <dir> and shows other candidates. |
The count case causes the most harm. vp env use shows a success message, and the user thinks that the Node.js version changed. But the shell still uses the previous version.
env.fish can call these commands with the builtin keyword, for example builtin count. fish does not let a user define a function named builtin, and all supported fish versions have this keyword. With builtin, the count, math, and complete cases work correctly. I did not check the commandline case with builtin.
A user function named contains or source breaks the startup of fish itself. fish then does not read conf.d at all. env.fish cannot prevent this case.
#3092 reports the same class of problem for Nushell. In Nushell, the result is a parse error at startup. In fish, the result is incorrect behavior without an error.
Reproduction
No repository is necessary. The steps use only vp and fish, and they write only to a temporary directory.
Steps to reproduce
-
Generate
env.fishin a temporary directory, so that no real shell profile changes.R=$(mktemp -d) HOME=$R/home ZDOTDIR=$R/home XDG_CONFIG_HOME=$R/setup-config VP_HOME=$R/vp vp env setup --env-only -
Make a fish configuration directory.
conf.d/vite-plus.fishsourcesenv.fish, asvp env setupdoes.functions/count.fishis the user's function.mkdir -p "$R/case-count/fish/conf.d" "$R/case-count/fish/functions" printf 'source "%s"\n' "$R/vp/env.fish" > "$R/case-count/fish/conf.d/vite-plus.fish" printf 'function count\n echo 0\nend\n' > "$R/case-count/fish/functions/count.fish" -
Start fish with this configuration.
cd "$R" env -u VP_NODE_VERSION XDG_CONFIG_HOME="$R/case-count" HOME="$R/case-count" VP_HOME="$R/vp" fish -
In fish, run these commands.
vp env use 20.18.0 --no-install echo $VP_NODE_VERSION
Expected result: echo $VP_NODE_VERSION prints 20.18.0.
Actual result: vp env use prints Using Node.js v20.18.0 (resolved from 20.18.0), but echo $VP_NODE_VERSION prints an empty line.
Without functions/count.fish, the same steps print 20.18.0.
Script that checks all four cases
#!/bin/sh
set -eu
VP=${VP:-vp}
FISH=${FISH:-fish}
R=$(mktemp -d)
HOME=$R/home ZDOTDIR=$R/home XDG_CONFIG_HOME=$R/setup-config VP_HOME=$R/vp \
"$VP" env setup --env-only </dev/null >/dev/null
mkdir -p "$R/project"
printf '{ "name": "demo", "scripts": { "build": "echo build" } }\n' > "$R/project/package.json"
run() {
dir=$R/case-$1
mkdir -p "$dir/fish/conf.d" "$dir/fish/functions"
printf 'source "%s"\n' "$R/vp/env.fish" > "$dir/fish/conf.d/vite-plus.fish"
[ "$1" = none ] || printf 'function %s\n %s\nend\n' "$1" "$2" > "$dir/fish/functions/$1.fish"
(cd "$R" && env -u VP_NODE_VERSION XDG_CONFIG_HOME="$dir" HOME="$dir" VP_HOME="$R/vp" \
"$FISH" -i -c "$3" </dev/null 2>&1) || true
}
USE='vp env use 20.18.0 --no-install >/dev/null 2>&1; echo "VP_NODE_VERSION=[$VP_NODE_VERSION]"'
USE_C='vp -C project env use 20.18.0 --no-install >/dev/null 2>&1; echo "VP_NODE_VERSION=[$VP_NODE_VERSION]"'
COMPLETE='echo "vpr completion rules: $(builtin complete -c vpr | builtin count)"'
CANDIDATES='echo "candidates for \"vpr -C project \": [$(builtin complete -C "vpr -C project ")]"'
echo "== count"; run none '' "$USE"; run count 'echo 0' "$USE"
echo "== math"; run none '' "$USE_C"; run math 'echo 99' "$USE_C"
echo "== complete"; run none '' "$COMPLETE"; run complete 'true' "$COMPLETE"
echo "== commandline"; run none '' "$CANDIDATES"; run commandline 'true' "$CANDIDATES"
Output:
== count
VP_NODE_VERSION=[20.18.0]
VP_NODE_VERSION=[]
== math
VP_NODE_VERSION=[20.18.0]
VP_NODE_VERSION=[]
== complete
vpr completion rules: 1
vpr completion rules: 0
== commandline
candidates for "vpr -C project ": []
candidates for "vpr -C project ": [run Run tasks]
In each pair, the first line has no user function, and the second line has one.
System Info
vp v1.3.0
fish 4.9.3
macOS
Used Package Manager
npm
Logs
No error appears. The "Steps to reproduce" section shows the output.
Validations
- Read the Contributing Guidelines.
- Check that there isn't already an issue for the same bug.
- Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
- The provided reproduction is a minimal reproducible example.
- Ngôn ngữ chính
- Rust
- Star
- 6.3k
- Fork
- 283
- Merge trung bình
- 1 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 231
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của voidzero-dev/vite-plus
-
pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
voidzero-dev/vite-plus#2882 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
voidzero-dev/vite-plus#2097 · 10 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`pnpm create vite-plus` and `yarn create vite-plus` fail with `spawn vp ENOENT` when `vp` is not on PATHCó thể đã có người làm @fengmk2 đã nhận 1 ngày trước. Đang mởbug
voidzero-dev/vite-plus#3177 · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
vp migrate doesn't flag esbuild-specific config (minify: "esbuild") — migrated project fails to build on Vite 8Có thể đã có người làm @john-okeefe đã nhận 1 ngày trước. Đang mởcontribution welcome
voidzero-dev/vite-plus#3176 · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`vp run`: scripts get a non-blocking stdin (EAGAIN) when `run` tasks in vite.config.ts use constantsĐang mởpending triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
voidzero-dev/vite-plus#3155 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của voidzero-dev/vite-plus
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
project-robius/robrix#1177 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Quadratic time in Query::bind() makes large parameterized queries (multi-row INSERT) very slowĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
ClickHouse/clickhouse-rs#497 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
test(breg): postgres_startup needs the tooling feature its required-features does not declareĐang mởarea:breg bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
registrystack/registry-stack#2307 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
farion1231/cc-switch#8696 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày