`RUN` is formatted as POSIX shell after `SHELL` switches to PowerShell or cmd
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
- 72/100
Hướng nghiên cứu
Start by tracing how dockerfmt parses and formats shell-form RUN, CMD, and ENTRYPOINT instructions, then follow how the Dockerfile SHELL instruction is represented and used. Reproduce with the PowerShell example in the issue and inspect existing formatter tests. Done means shell-form bodies remain unchanged after a non-POSIX SHELL instruction, with tests covering the reported panic and unwanted rewriting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
RUN commands are always parsed and formatted as POSIX shell, even after a SHELL instruction switches to PowerShell or cmd. Depending on the command, dockerfmt either panics or silently rewrites it using shell quoting rules.
Reproduce
FROM mcr.microsoft.com/powershell
SHELL ["pwsh", "-Command"]
RUN if ($true) { Write-Host hi }
dockerfmt Dockerfile
Actual
Exit code 2:
Error parsing: if ($true) { Write-Host hi }
panic: 1:12: statements must be separated by &, ; or a newline
A command that happens to parse as shell gets rewritten instead:
SHELL ["pwsh", "-Command"]
RUN Get-ChildItem -Path C:\ | Select-Object Name
becomes
RUN Get-ChildItem -Path C:\ | Select-Object Name
because shell reads \ as an escaped space.
Expected
After a SHELL instruction that selects a non-POSIX shell, leave the shell-form RUN, CMD and ENTRYPOINT bodies untouched. That is the usual setup for Windows images.
Reproduced with v0.5.4 and with main at a5868c2.
- Ngôn ngữ chính
- Go
- Star
- 626
- Fork
- 23
- Merge trung bình
- 6 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 reteps/dockerfmt
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
`MAINTAINER` to `LABEL` conversion does not escape embedded quotesCó thể đã có người làm @RyoKusnadi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Tất cả issue của reteps/dockerfmt
Issue tương tự
-
agent-butler-finding bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
jordansmall/spindrift#6414 ·
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 68/100
Icinga/icinga-kubernetes#294 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Cluster details: the Control Plane version field has a different border color than its icon boxĐang mởkind/design sig/ui
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
kubermatic/dashboard#8449 ·
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 65/100
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 78/100
filecoin-project/curio#1632 ·
Maintainer thường phản hồi trong vòng 1 ngày