Skip to content

Commit

Permalink
fix: dot path normalized correctly for COPY
Browse files Browse the repository at this point in the history
In my previous fix on moby#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 moby#5070

Signed-off-by: Anthony Nandaa <[email protected]>
  • Loading branch information
profnandaa committed Jun 24, 2024
1 parent 07e2dce commit 272a461
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/dockerfile/dockerfile2llb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down

0 comments on commit 272a461

Please sign in to comment.