Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: dockerfile2llb: handle escaping of backslashes correctly
`shlex` in was treating single backslash "\\" in string as escape sequence, hence stripping them off. Modify `processCmdEnv` to double escape `\\`. This was in turn affecting the vertex `Name`, and mostly pronounced on Windows where backslashes are prevalent in path names. For example `C:\hello\world\path` was being rendered as `C:helloworldpath`, hence confusing users. Fixes #5250 Build progress before fix: ``` #5 [2/4] RUN echo C:helloworldpath #5 1.359 C:\hello\world\path #5 DONE 1.7s #6 [3/4] RUN echo C:\hello\escaped\path #6 1.734 C:\\hello\\escaped\\path #6 DONE 2.1s #7 [4/4] RUN echo "C:\hello\quoted\path" #7 1.765 "C:\hello\quoted\path" #7 DONE 2.1s ``` Build progress after fix: ``` #5 [2/4] RUN echo C:\hello\world\path #5 1.458 C:\hello\world\path #5 DONE 1.8s #6 [3/4] RUN echo C:\\hello\\escaped\\path #6 1.730 C:\\hello\\escaped\\path #6 DONE 2.1s #7 [4/4] RUN echo "C:\hello\quoted\path" #7 1.702 "C:\hello\quoted\path" #7 DONE 2.1s ``` You can also see that now paths in the step/vertex names now match those in the log lines right after the name. Signed-off-by: Anthony Nandaa <[email protected]>
- Loading branch information