lib/repo: Skip import via hardlink if repo owners don't match

Before this, if one had repos of matching mode but different owners,
which could happen if one e.g. makes a `bare` non-root repo in
`/ostree/deploy/$stateroot/var/tmp`, every time we tried to call `linkat()`
we'd get `EPERM` and fall back to a copy.

Fix this by saving the repo owner uid, and avoid trying to call `linkat()` if we
know it's going to fail. Of course most commonly in this scenario we'll
immediately fail trying to `chown` the files to `0`, but this is prep for a
future patch to improve `bare-user` → `bare-user-only` imports where we'll be a
bit more sophisticated.

Closes: #922
Approved by: alexlarsson
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-06-13 12:02:12 +00:00
1 parent 21eec96bfd
commit 695771667c
2 files changed
+10 -2

No files matched your search

+1
View File
@@ -116,6 +116,7 @@ struct OstreeRepo {
GHashTable *updated_uncompressed_dirs;
GHashTable *object_sizes;
uid_t owner_uid;
uid_t target_owner_uid;
gid_t target_owner_gid;