Nushell env bug: Positional completer input deprecated
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
The bad call is generated into ~/.config/vite-plus/env.nu at line 43, where the built-in update is called inside a pipeline. The shim $nu.data-dir/vendor/autoload/vite-plus.nu sources that file at startup. Start with the repro steps in the issue, then find the code that writes env.nu and see how it emits the update call. Done means the generated file parses when a user defines def update [], and the existing control case still loads.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Report
Nushell will not start on a machine where the user has defined a custom command
whose name collides with a builtin used by the generated completion file. The error
points at a file the user never wrote, so it reads as a vite-plus or Nushell bug
rather than a name collision in the user's own config.
Environment: vite-plus v1.3.0, Nushell 0.116.1, Arch Linux.
The trigger on my machine was an ordinary helper:
# ~/.config/nushell/aliases.nu
def update [] { # <-- Update system and Flatpaks
yay; flatpak update
}
Nothing in my dotfiles references vite-plus. Opening Nushell fails with:
Error: nu::parser::extra_positional_argument
x Extra positional argument.
,-[/home/USER/.config/vite-plus/env.nu:43:111]
42 | let fish_cmd = $"VP_COMPLETE=fish command vp | source; complete '--do-complete=($context)'"
43 | fish --command $fish_cmd | from tsv --flexible --noheaders --no-infer | rename value description | update value {|row|
: ^^|^^
: `-- extra positional argument
44 | let value = $row.value
`----
help: Usage: update
There is no prompt, no REPL, no way to fix it from inside the shell. The file has to
be edited by hand.
Mechanism
This is what makes it hard to report. vite-plus registers itself with Nushell by
writing a file into the auto-load directory; Nushell sources every .nu file there at
startup:
$ ls -la "$(nu -c '$nu.data-dir')/vendor/autoload/"
-rw-r--r-- 1 user user 81 ... vite-plus.nu
$ cat "$(nu -c '$nu.data-dir')/vendor/autoload/vite-plus.nu"
# Vite+ bin (https://viteplus.dev)
source "/home/josel/.config/vite-plus/env.nu"
So the load chain is:
~/.config/nushell/config.nu -> source ~/.config/nushell/aliases.nu (defines `update`)
$nu.data-dir/vendor/autoload/vite-plus.nu -> source ~/.config/vite-plus/env.nu (calls builtin `update`)
In Nushell, def creates a global custom command, so def update [] shadows the
built-in update <field> <replacement> for the entire session. The generated
env.nu calls the built-in at line 43, and Nushell fails at parse time, before
executing anything.
Two details worth calling out:
alias update = sysupdatedoes not work as a workaround. Aliases shadow too.- Any built-in can be shadowed this way, so this is not specific to
update. A user
command namedselect,where,rename,str,path, etc. would collide the
same way.
Evidence
Reproduction
https://gist.github.com/Kat404/4e275bbbcfa79f69182fd1a75dda1565
Steps to reproduce
Steps to reproduce
Requires Nushell only. Steps 1 and 2 do not need vite-plus installed and do not
break your own shell.
1. Minimal repro, no vite-plus, ~5 seconds
R=$(mktemp -d); mkdir -p "$R/cfg/nushell" "$R/data/nushell/vendor/autoload"
printf 'def update [] { echo shadowed }\n' > "$R/cfg/nushell/aliases.nu"
printf 'source %s/cfg/nushell/aliases.nu\n' "$R" > "$R/cfg/nushell/config.nu"
printf 'source "%s/env.nu"\n' "$R" > "$R/data/nushell/vendor/autoload/vite-plus.nu"
printf '[[a b]; [1 2]] | update a {|row| $row.a }\n' > "$R/env.nu"
printf 'exit\n' | XDG_CONFIG_HOME="$R/cfg" XDG_DATA_HOME="$R/data" nu
Expected:
Error: nu::parser::extra_positional
x Extra positional argument.
,-[.../env.nu:1:25]
1 | [[a b]; [1 2]] | update a {|row| $row.a }
: |
: `-- extra positional argument
2. Same failure against the real generated file (safe, does not touch your config)
printf 'def update [] { }\n' > /tmp/shadow.nu
nu -c 'source /tmp/shadow.nu; source ~/.config/vite-plus/env.nu'
Expected: extra positional argument at env.nu:43:111 with help: Usage: update,
matching the report above exactly.
3. Control
nu -c 'def sysupdate [] { }; source ~/.config/vite-plus/env.nu; print "loads clean"'
Expected: loads clean. The only difference is the command name.
4. Deterministic container, Docker or Podman
https://gist.github.com/Kat404/4e275bbbcfa79f69182fd1a75dda1565
curl -O https://gist.githubusercontent.com/Kat404/4e275bbbcfa79f69182fd1a75dda1565/raw/2a4623056500cc2a1fa202cd9af5643606192521/Containerfile
podman build -t nu-shadow-repro ./Containerfile
podman run --rm nu-shadow-repro
The Containerfile is self-contained and asserts both directions: the build fails if
the bug does not reproduce, and fails again if the renamed control case still breaks.
CASE A (def update []): BUG REPRODUCED
CASE B (def sysupdate []): config loads clean
Workaround
Rename the user command so it no longer shadows a built-in:
def sysupdate [] { yay; flatpak update }
Environment
- vite-plus
v1.3.0 - Nushell
0.116.1(/usr/bin/nu, official musl static release) - Arch Linux, kernel 6.x, GNOME
- Generated file at fault:
~/.config/vite-plus/env.nu, line 43 - Auto-load shim:
$nu.data-dir/vendor/autoload/vite-plus.nu - Podman
6.1.4for the container repro - Note: Nushell 0.116.1 prints the error code as
nu::parser::extra_positional;
older/other builds printnu::parser::extra_positional_argument. Same defect.
System Info
$ vp env current
VITE+ - The Unified Toolchain for the Web
Node.js:
Version 26.11.1
Source system PATH
Bin Path /usr/bin/node
Installed true
Mode system_first
$ vp --version
VITE+ - The Unified Toolchain for the Web
vp v1.3.0
Local vite-plus:
vite-plus Not found
Tools:
vite Not found
rolldown Not found
vitest Not found
oxfmt Not found
oxlint Not found
oxlint-tsgolint Not found
tsdown Not found
Environment:
Package manager Not found
Node.js v24.22.0
Used Package Manager
pnpm
Logs
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
- 6k
- Fork
- 274
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 205
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
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
voidzero-dev/vite-plus#3091 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
voidzero-dev/vite-plus#3090 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`vp migrate` copies string `extends` paths from `.oxlintrc.json` into `lint`, which `vp lint` rejectsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
voidzero-dev/vite-plus#3089 ·
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ự
-
Stack overflow in `check bans` with `include-dependencies = true` and a dev-dependency cycleĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
EmbarkStudios/cargo-deny#910 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
tursodatabase/turso#10054 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
build: Update rust versionCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởdependencies
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
ibm-granite-community/granite-cli#229 ·
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 82/100
Maintainer thường phản hồi trong vòng 2 ngày
-
setTargetAtTime booked ahead of time starts its curve early (values blow up before start_time)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
orottier/web-audio-api-rs#658 ·