core: Skip (and warn on) rpmfi overrides outside of /{usr,etc,var}

I still need to query whether Fedora has anything like this; maybe `/boot`? But
things are not likely to work right now if we do, so let's ignore it.

Closes: #677
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-03-11 10:45:39 -05:00 committed by Atomic Bot
parent ab7431c458
commit 77fa10cfbe

View File

@ -2222,6 +2222,7 @@ apply_rpmfi_overrides (int tmp_metadata_dfd,
{ {
int i; int i;
_cleanup_rpmfi_ rpmfi fi = NULL; _cleanup_rpmfi_ rpmfi fi = NULL;
gboolean emitted_nonusr_warning = FALSE;
g_autofree char *path = get_package_relpath (pkg); g_autofree char *path = get_package_relpath (pkg);
if (!get_package_metainfo (tmp_metadata_dfd, path, NULL, &fi, error)) if (!get_package_metainfo (tmp_metadata_dfd, path, NULL, &fi, error))
@ -2261,6 +2262,16 @@ apply_rpmfi_overrides (int tmp_metadata_dfd,
/* The tree uses usr/etc */ /* The tree uses usr/etc */
fn = modified_fn = g_strconcat ("usr/", fn, NULL); fn = modified_fn = g_strconcat ("usr/", fn, NULL);
} }
else if (!g_str_has_prefix (fn, "usr/"))
{
/* TODO: query whether Fedora has anything in this category we care about */
if (!emitted_nonusr_warning)
{
sd_journal_print (LOG_WARNING, "Ignoring rpm mode for non-/usr content: %s", fn);
emitted_nonusr_warning = TRUE;
}
continue;
}
if (fstatat (tmprootfs_dfd, fn, &stbuf, AT_SYMLINK_NOFOLLOW) != 0) if (fstatat (tmprootfs_dfd, fn, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
{ {