checkout: Ensure copies of unreadable usermode checkouts are readable
authorColin Walters <walters@verbum.org>
Wed, 16 Sep 2020 13:23:04 +0000 (13:23 +0000)
committerColin Walters <walters@verbum.org>
Wed, 16 Sep 2020 15:14:54 +0000 (15:14 +0000)
commit3441a48c5835e9470a77032ec150cde87aabe242
tree6560dc3a510b25a461153b27e817e1c22a93c270
parentca2f3435bea2f4fb1d2ad86b7508dcdb4fc7b4ac
checkout: Ensure copies of unreadable usermode checkouts are readable

The extreme special case of "zero mode" files like `/etc/shadow`
comes up again.  What we want is for "user mode" checkouts to
override it to make the file readable; otherwise when operating
as non-root without `CAP_DAC_OVERRIDE` it becomes very difficult
to work with.

Previously, we were hardlinking these files, but then it intersects
with *another* special case around zero sized files, which is
*also* true for `/etc/shadow`.

Trying to avoid hardlinking there unveiled this bug - when
we go to do a copy checkout, we need to override the mode.
src/libostree/ostree-repo-checkout.c
tests/test-basic-user.sh