repo: Add a checkout option to not hardlink zero-sized files
authorColin Walters <walters@verbum.org>
Thu, 11 Oct 2018 13:22:16 +0000 (09:22 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 11 Oct 2018 16:32:25 +0000 (16:32 +0000)
commit673cacd633f9d6b653cdea530657d3e780a41bbd
tree387136eb9c26e6441c927ae2850ef39003d40f55
parentc70526841e86bf72d0714db84305cd35ac62f527
repo: Add a checkout option to not hardlink zero-sized files

In rpm-ostree we've hit a few cases where hardlinking zero-sized
files causes us problems.  The most prominent is lock files in
`/usr/etc`, such as `/usr/etc/selinux/semanage.LOCK`.  If there
are two zero-sized lock files to grab, but they're hardlinked,
then locking will fail.

Another case here is if one is using ostree inside a container
and don't have access to FUSE (i.e. `rofiles-fuse`), then the
ostree hardlinking can cause files that aren't ordinarily hardlinked
to become so, and mutation of one mutates all.  An example where
this is concerning is Python `__init__.py` files.

Now, these lock files should clearly not be in the tree to begin
with, but - we're not gaining a huge amount by hardlinking these
files either, so let's add an option to disable it.

Closes: #1752
Approved by: jlebon
src/libostree/ostree-repo-checkout.c
src/libostree/ostree-repo.h
src/ostree/ot-builtin-checkout.c
tests/basic-test.sh