From 272a461b92844cce6d8fda858093a45f919bfdab Mon Sep 17 00:00:00 2001 From: Anthony Nandaa Date: Mon, 24 Jun 2024 18:36:02 +0300 Subject: [PATCH] fix: dot path normalized correctly for COPY In my previous fix on #4825, I had removed this line knowing that all that had been addressed in `pahtRelativeToWorkingDir`: ```go if cfg.params.DestPath == "." // <-- this one || cfg.params.DestPath == "" || cfg.params.DestPath[len(cfg.params.DestPath)-1] == filepath.Separator { dest += string(filepath.Separator) } ``` However, I had overlooked the `"."` scenario. `""`, `"/"` are all handled correctly in `system.NormalizePath()`. This change therefore undoes this, to make sure "." is transformed correctly to "./" during COPY operation. fixes #5070 Signed-off-by: Anthony Nandaa --- frontend/dockerfile/dockerfile2llb/convert.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/dockerfile/dockerfile2llb/convert.go b/frontend/dockerfile/dockerfile2llb/convert.go index 6a163c73971c2..c7f501fe15d1c 100644 --- a/frontend/dockerfile/dockerfile2llb/convert.go +++ b/frontend/dockerfile/dockerfile2llb/convert.go @@ -1319,6 +1319,12 @@ func dispatchCopy(d *dispatchState, cfg copyConfig) error { return err } + // handle case for "." path + // using "/" since paths already nomalized to UNIX style + if cfg.params.DestPath == "." { + dest += "/" + } + var copyOpt []llb.CopyOption if cfg.chown != "" {