michael-yuji / xc

FreeBSD container engine
Other
87 stars 9 forks source link

ocitar create --zfs-diff adds one extra copy per changed parent #10

Open Crest opened 1 year ago

Crest commented 1 year ago

When ocitar parses the creation or modification of a directory it adds the directory to the list of paths to archive. Both zfs diff and tar both recurse over all files (including subdirectories) in these directories. If I understand the code correctly it should be enough to change the tar -cf- -T- invocation to tar -cf -nT- when in zfs_diff mode, but I'm not certain if would interact with whiteouts on anything but normal filese e.g. does the format require one whiteout for each file in a directory to be removed or are whiteouts applied by recursively to a directory by deleting the directory content before the directory?

Crest commented 1 year ago

According to https://github.com/opencontainers/image-spec/blob/main/layer.md#distributable-format layer changesets encoded as tar archives "MUST NOT include duplicate entries for file paths in the resulting tar archive".