flatpak-context: Properly flatten filesystem permissions

When generating flattened permissions (i.e. for --show-permissions or
for the /.flatpak-info file) we're currently flattening the permissions
i.e. don't show things that would only affect layering the permissions).

However, the code doesn't currently do this for the filesystem key, so
implement that. This means we only display the permissions that are
in effect, and don't display "negative" permissions like !host which
are not meaningful in this context.
This commit is contained in:
Alexander Larsson
2022-01-20 17:28:38 +01:00
committed by Alexander Larsson
parent 924a7d29c5
commit 7bec38c9d1

View File

@@ -1963,7 +1963,8 @@ flatpak_context_save_metadata (FlatpakContext *context,
NULL, &value))
{
g_warn_if_fail (GPOINTER_TO_INT (value) == FLATPAK_FILESYSTEM_MODE_NONE);
g_ptr_array_add (array, g_strdup ("!host:reset"));
if (!flatten)
g_ptr_array_add (array, g_strdup ("!host:reset"));
}
g_hash_table_iter_init (&iter, context->filesystems);
@@ -1971,6 +1972,9 @@ flatpak_context_save_metadata (FlatpakContext *context,
{
FlatpakFilesystemMode mode = GPOINTER_TO_INT (value);
if (flatten && mode == FLATPAK_FILESYSTEM_MODE_NONE)
continue;
/* We already did this */
if (g_str_equal (key, "host-reset"))
continue;