project-stacker / stacker

Build OCI images natively from a declarative format
https://stackerbuild.io
Apache License 2.0
208 stars 34 forks source link

Bug: Whiteouts ot handled correctly #627

Closed hallyn closed 3 months ago

hallyn commented 5 months ago

stacker version

v1.0.0-rc14-d3f8ebd

Describe the bug

# a1.tar has /a1/file
bb:
  from:
    type: docker
    url: docker://busybox
  run: |
    mkdir /a1
    touch /a1/file

nodir:
  from:
    type: built
    tag: bb
  run: |
    rm -rf /a1

emptydir:
  from:
    type: built
    tag: bb
  run: |
    rm -rf /a1
    mkdir /a1

fulldir:
  from:
    type: built
    tag: bb
  run: |
    rm -rf /a1
    mkdir /a1
    touch /a1/newfile

Run stacker build against that, and look at the outputs.

For nodir, we have simply:

---------- 0/0               0 1969-12-31 18:00 .wh.a1

Which is correct.

For emptydir, we have the exact same thing, just .wh.a1, in fact the .tar.gz for the top layer is the same file as for nodir. This is wrong.

For fulldir, we have:

---------- 0/0               0 1969-12-31 18:00 .wh.a1
-rw-rw-r-- 0/0               0 2024-06-14 00:10 a1/newfile

Per https://github.com/opencontainers/image-spec/blob/main/layer.md, I believe .wh.a1 should not be there, and a1/.wh..wh..opq should exist, for both emptydir and fulldir.

To reproduce

  1. Configuration
  2. Client tool used
  3. Seen error

Expected behavior

No response

Screenshots

No response

Additional context

No response

rchincha commented 4 months ago
nodir:
  from:
    type: built
    tag: bb
  run: |
    rm -rf /a1

emptydir:
  from:
    type: built
    tag: bb
  run: |
    rm -rf /a1
    mkdir /a1

But if a whiteout is generated by overlayfs in emptydir, not quite stacker's fault right?