overlayfs-tools
overlayfs-tools copied to clipboard
Whiteout files and opaque directories should not be copied to the lower filesystem?
Maybe this is by design...
Say you have a lower filesystem, "/lower" containing a directory "/lower/d" and a file "lower/f".
Then you mount an overlay, "/overlay" using an empty upper filesystem, "/upper".
Then rm -rf /overlay/d /overlay/f.
Using overlay merge -l /lower -u /upper command, in the generated shell script you get
rm -rf '/lower/d'
mv -T '/upper/d' '/lower/d'
rm -rf '/lower/f'
mv -T '/upper/f' '/lower/f'
The whiteout file and opaque directory from /upper are moved in after deleting the existing file.
I guess its a simple find 1-liner to find these files and delete them from "/lower" if you don't want them but I wonder if overlayfs-tools should either not copy these files in the first place or provide an option not to copy them.
This is really odd, I can't reproduce this now! Maybe it was the way I set up my mounts originally. I think the mount point for the overlay might have been within the upper directory, which could have messed things up. This can be closed if no one can reproduce, but maybe there's an edge case here.
Whiteout file should be deleted. It's definitely a bug if the problem can be reproduced.
However, with previous implementation, the whiteout file should already be removed, as https://github.com/kmxz/overlayfs-tools/blob/1cb719fd455d84298123bf2ab129a3104e02f0f6/logic.c#L332 did rm the whiteout file.
Let's keep this issue open to see if anyone can reproduce it.