[Bug]: `nvidia-container-cli list` default listing depends on argv count (`--imex-channel 0` vs `--imex-channel=0`, `--no-persistenced` prints nothing)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 86/100
Hướng nghiên cứu
Đọc src/cli/list.c, đặc biệt là list_parser() tại ARGP_KEY_END, và theo dõi cách các tùy chọn chọn lựa đã phân tích thiết lập ngữ cảnh liệt kê. Dùng CLI để tái hiện cách viết argv và các trường hợp opt-out; issue cho biết đã sử dụng một backend stub. Hoàn tất khi các cách viết tùy chọn tạo ra đầu ra tương đương, các cờ opt-out giữ nguyên danh sách mặc định trừ các tệp bị loại trừ và các tùy chọn chọn lựa tường minh giữ nguyên hành vi hiện tại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Motivation
I was checking which files nvidia-container-cli list reports when IMEX channels or the new opt-out flags are used, and the output changed depending on how I spelled the same option.
- I would like to work on this issue.
Describe the bug
list prints everything (device nodes, binaries, libraries, IPCs, firmware) when it is called without options. When --imex-channel was added, the IMEX-only case was meant to keep that default listing and add the channel nodes on top. The check in list_parser() (src/cli/list.c, ARGP_KEY_END) counts argv entries instead of looking at which options were given:
if (state->argc == 1 || (state->argc == 2 && ctx->imex_channels != NULL)) {
argp accepts both --imex-channel=0 (one argv entry) and --imex-channel 0 (two argv entries), so the result depends on the spelling:
list --imex-channel=0prints the full listing plus/dev/nvidia-caps-imex-channels/channel0.list --imex-channel 0prints only/dev/nvidia-caps-imex-channels/channel0.list --imex-channel=0 --imex-channel=1prints only the two channel nodes, whilelist --imex-channel=0,1prints everything.
The same check also affects the opt-out flags added in v1.16.2. --no-persistenced, --no-fabricmanager and --no-gsp-firmware only change what the driver lookup returns; they do not select anything to list. But each one makes argc == 2, so list --no-persistenced (or --no-gsp-firmware, or --no-fabricmanager) prints nothing and exits 0. The ctx->list_firmwares = false; in the --no-gsp-firmware case suggests the flag was expected to remove firmware from the default listing, not to empty it.
The IMEX gate has been there since v1.15.0, the opt-out flags since v1.16.2, and both are still on current main (c7727e5).
To Reproduce
The difference is in argument parsing only, so it shows on any host. The output below is from the current main CLI front-end built against a stub backend that reports one GPU, one binary, one library, the persistenced socket and one GSP firmware file:
$ nvidia-container-cli list --imex-channel=0
/dev/nvidiactl
/dev/nvidia0
/dev/nvidia-caps-imex-channels/channel0
/usr/bin/nvidia-smi
/usr/lib/libcuda.so.580.0.0
/run/nvidia-persistenced/socket
/lib/firmware/nvidia/580.0.0/gsp_ga10x.bin
$ nvidia-container-cli list --imex-channel 0
/dev/nvidia-caps-imex-channels/channel0
$ nvidia-container-cli list --no-persistenced
$ echo $?
0
$ nvidia-container-cli list --no-gsp-firmware
$ nvidia-container-cli list --no-fabricmanager
On a real host the first command prints the full driver file list; the second one still prints only the channel node.
Expected behavior
--imex-channel 0and--imex-channel=0give the same output, and repeating--imex-channelbehaves like a comma-separated list.list --no-persistencedprints the default listing without the persistenced socket;list --no-gsp-firmwareprints it without the firmware files;list --no-fabricmanagerprints it without the fabricmanager socket.- Options that select what to list (
--device,--libraries,--binaries,--ipcs,--firmwares,--compat32,--mig-config,--mig-monitor) keep their current behavior: only the selected parts are printed.
Proposed fix
In ARGP_KEY_END, decide whether to apply the default listing from the parsed context instead of from state->argc: apply it when none of the selecting options above was given. --imex-channel and the --no-* flags then only modify the default listing, however they are spelled. The ctx->list_firmwares = false; line in the --no-gsp-firmware case is dropped: firmware lookup is already skipped through the driver option, and keeping the line would make list -f --no-gsp-firmware fall back to the full listing. The change is about 7 lines in src/cli/list.c and does not touch configure or the library.
I checked the change against these cases: list, list --libraries, list --device=0, list -f --no-gsp-firmware, list --compat32 and list --imex-channel=0 print exactly what they print today. list --imex-channel 0, repeated --imex-channel, and the three --no-* flags behave as described above. There is no C test suite in the repository, so I used a small out-of-tree script that runs the CLI against a stub backend; I can share it if that helps.
Environment (please provide the following information):
- Version: main at c7727e5 (same code in v1.16.2 through v1.20.2)
- OS / Distribution: Ubuntu 24.04 (aarch64)
- Kernel Version: n/a (argument parsing only)
- Container Runtime Version: n/a (
nvidia-container-cli listcalled directly)
This change was drafted with Claude Code (claude-opus-5-5); the test results above are from the runs described.
- Ngôn ngữ chính
- C
- Star
- 1.1k
- Fork
- 278
- Merge trung bình
- 3 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 NVIDIA/libnvidia-container
-
needs-triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
NVIDIA/libnvidia-container#408 ·
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
NVIDIA/libnvidia-container#409 ·
-
question
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
NVIDIA/libnvidia-container#404 ·
-
OpenSuSE Leap 15.2 is missingCó thể đã có người làm @gusraggio đã nhận 44 ngày trước. Đang mởquestion
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
NVIDIA/libnvidia-container#100 · 9 bình luận · 1 reaction ·
Tất cả issue của NVIDIA/libnvidia-container
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition rootCó thể đã có người làm @tuhaihe đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/cloudberry#2356 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
windows-artifacts: the win-arm64 job uses a Visual Studio generator missing from windows-11-armĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
-
Add Royalty funding badgeĐang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
crosspoint-reader/crosspoint-reader#4535 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[core] Clients never advertise RNS_UD_CS_SUPPORT_ERRINFO_PDU, so a conforming server can't send them Set Error InfoCó thể đã có người làm @akallabeth đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
FreeRDP/FreeRDP#14230 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày