`RUN` is formatted as POSIX shell after `SHELL` switches to PowerShell or cmd
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 626
- Forks
- 23
- Merge medio
- 6 d 23 h
- PR fusionados (30 d)
- 3
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de reteps/dockerfmt
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
`MAINTAINER` to `LABEL` conversion does not escape embedded quotesPosiblemente ocupada @RyoKusnadi la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Todos los issues de reteps/dockerfmt
Issues similares
-
Query cache: a failed cache page read leaves the set request's read lock held, so the scan hangsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
turbot/steampipe-plugin-sdk#986 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
router-for-me/CLIProxyAPI#7307 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
betterleaks/betterleaks#460 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
openmcp-project/service-provider-crossplane#330 ·
Los mantenedores suelen responder en 1 día