Skip to content

Commit

Permalink
Fix missing mounts in execOp cache map
Browse files Browse the repository at this point in the history
A bug in cloneExecOp prevented mounts from being included in the digest
computed for the execOp cache map. This could lead to an exec being
wrongly cached when a different mount was used for a subsequent
execution.

Repro case:
https://gist.github.com/aaronlehmann/cfeaefc028df8127fb85b9b5f9125f2d

In this example, pass2 should generate an empty diff because the /from
and /to mounts are the same busybox image. But before the fix, it uses
the cached result from pass1 (with different mounts) instead.

Signed-off-by: Aaron Lehmann <[email protected]>
(cherry picked from commit 0e106e6)
  • Loading branch information
aaronlehmann authored and tonistiigi committed Apr 22, 2021
1 parent a1094c6 commit f1ae3a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions solver/llbsolver/ops/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ func cloneExecOp(old *pb.ExecOp) pb.ExecOp {
}
n.Meta = &meta
n.Mounts = nil
for i := range n.Mounts {
m := *n.Mounts[i]
for i := range old.Mounts {
m := *old.Mounts[i]
n.Mounts = append(n.Mounts, &m)
}
return n
Expand Down

0 comments on commit f1ae3a2

Please sign in to comment.