lib/checkout: fallback to checksum for UNION_IDENTICAL
There's a subtle issue going on with the way we use `UNION_IDENTICAL` now in rpm-ostree. Basically, the crux of the issue is that we checkout the whole tree from the system repo, but then overlay packages by checking out from the pkgcache repo. This is an easy way to break the assumption that we will be merging hardlinks from the same repo. This ends up causing issues like: https://github.com/projectatomic/rpm-ostree/issues/1047 There, `vim-minimal` is already part of the host and has an object for `/usr/share/man/man1/ex.1.gz`. `vim-common` has that same file, but because it's unpacked in the pkgcache repo first, the hardlinks are not the same. There are a few ways we *could* work around this in rpm-ostree itself, e.g. by re-establishing hardlinks when we do the content pull into the system repo, but it still felt somewhat hacky. Let's just do this the proper way and fall back to checksumming the target file if needed, which is what librpm does as well in this case. Note that we only checksum if they're not hard links, but they're the same size. Closes: #1258 Approved by: cgwalters
This commit is contained in:
1 parent
2a9c5efe1d
commit
9503189362
4 files changed
+48
-3
No files matched your search
@@ -1576,6 +1576,24 @@ _ostree_gfileinfo_equal (GFileInfo *a, GFileInfo *b)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Same motives as _ostree_gfileinfo_equal(), but for stat structs. */
|
||||
gboolean
|
||||
_ostree_stbuf_equal (struct stat *stbuf_a, struct stat *stbuf_b)
|
||||
{
|
||||
/* trivial case */
|
||||
if (stbuf_a == stbuf_b)
|
||||
return TRUE;
|
||||
if (stbuf_a->st_mode != stbuf_b->st_mode)
|
||||
return FALSE;
|
||||
if (S_ISREG (stbuf_a->st_mode) && (stbuf_a->st_size != stbuf_b->st_size))
|
||||
return FALSE;
|
||||
if (stbuf_a->st_uid != stbuf_b->st_uid)
|
||||
return FALSE;
|
||||
if (stbuf_a->st_gid != stbuf_b->st_gid)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Many parts of libostree only care about mode,uid,gid - this creates
|
||||
* a new GFileInfo with those fields see.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user