Feature option values are changed before install.sh sees them: quotes are stripped, and `$…` is expanded or executed
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
- Nửa ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- shell, typescript
- Lĩnh vực
- cli, developer-experience
Hướng nghiên cứu
Start in getFeatureEnvVariables in src/spec-node/containerFeatures.ts, which writes each option as NAME="value" without escaping, and compare it with escapeQuotesForShell, which the issue says already handles the wrapper's Options echo. Reproduce with the local ./echo-opt Feature from the issue, where the value contains quotes, $HOME and $(id -un). Done means the printed value matches the configured string exactly, values with spaces still work, and the behaviour change for $ expansion is either accepted or handled, which needs a maintainer decision first.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
A Feature can receive a different string option value from the one configured in
devcontainer.json. Quotes are removed, $VAR is expanded, $(…) and backticks are executed, and backslashes are consumed. The build still succeeds, so nothing
signals that the value changed.
Repro (devcontainer CLI 0.89.0)
A local Feature with one string option, value, whose install.sh prints it:
#!/bin/sh
printf '%s\n' "$VALUE"
"features": { "./echo-opt": { "value": "say \"hi\" to $HOME as $(id -un)" } }
- Expected:
say "hi" to $HOME as $(id -un) - Actual:
say hi to /root as root
A value with a space inside quotes, such as A="two words", fails the build instead,
with devcontainer-features.env: line 1: words: not found.
Cause
getFeatureEnvVariables (src/spec-node/containerFeatures.ts) writes each option as
NAME="value" without escaping. The install wrapper then sources the file
(set -a; . ./devcontainer-features.env), so the shell interprets the value. Issue #148
and PR #149 fixed this for spaces, but not for ", $, backticks or \.
Suggested fix
Write each value in single quotes, with ' escaped as '\''. That's what
escapeQuotesForShell already does for the wrapper's Options echo. This changes
behaviour for anyone relying on $ being expanded in option values today.
- Ngôn ngữ chính
- TypeScript
- Star
- 3k
- Fork
- 462
- Merge trung bình
- 13 giờ 28 phút
- Pull request đã merge (30 ngày)
- 2
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 devcontainers/cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
devcontainers/cli#1325 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
devcontainers/cli#1203 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 68/100
devcontainers/cli#1178 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`devcontainer build` fails on Buildx 0.37.2 because the generated Dockerfile is outside the Compose bake contextCó thể đã có người làm @v-Kaniska244 đã nhận 4 ngày trước. Đang mở
devcontainers/cli#1320 · 2 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Allow setting build attestationsĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
devcontainers/cli#1319 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của devcontainers/cli