buildkit/snapshot
Erik Sipsma 0a2a4fe066 diffApply: set dir opaque when overwriting whiteout
Before this, there was a bug triggered under the following conditions:
1. An overlay snapshotter was being used, which caused the optimization
   of preparing a new snapshot off of the base layers to be triggered
2. The base layers contained a directory that had contents
3. One subsequent layer deleted that directory w/out recreating it
4. A later layer recreated the directory

In this case, what happened was a whiteout device would be created as
part of 3 above but then in step 4 the whiteout device would be removed
and replaced with a plain directory. The problem is that such a
directory doesn't block out the files from step 2 and it doesn't know
about them because they are in a lowerdir (not the upperdir being
applied to).

The simplest fix, which this commit implements, is to just set the
directory created in step 4 as opaque, which enables the correct
behavior of blocking out files below it.

This was missed in test coverage before because tests for opaque
handling always combined 3+4 into one layer, whereas the bug requires
they be separate layers. A new integration test has been added to cover
this case.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-02-09 20:15:11 -08:00
..
containerd all: unify the specs-go package import alias to ocispecs 2021-08-11 08:29:09 +09:00
imagerefchecker all: unify the specs-go package import alias to ocispecs 2021-08-11 08:29:09 +09:00
diffapply_unix.go diffApply: set dir opaque when overwriting whiteout 2022-02-09 20:15:11 -08:00
diffapply_windows.go snapshot: cleanup diffApply and prepare for DiffOp 2021-12-09 21:21:35 -08:00
localmounter.go snapshot: cleanup diffApply and prepare for DiffOp 2021-12-09 21:21:35 -08:00
localmounter_unix.go Add initial MergeOp implementation. 2021-11-18 11:10:48 -08:00
localmounter_windows.go Give a name to the only mount we care about 2020-07-24 20:40:46 +10:00
merge.go diffApply: set dir opaque when overwriting whiteout 2022-02-09 20:15:11 -08:00
snapshotter.go Disable redirect_dir for overlayfs snapshotter 2021-12-24 11:58:44 +09:00
snapshotter_test.go snapshot: cleanup diffApply and prepare for DiffOp 2021-12-09 21:21:35 -08:00
staticmountable.go Disable redirect_dir for overlayfs snapshotter 2021-12-24 11:58:44 +09:00