From 7bec38c9d122d2dbcc8f3cf6017afe1fbf1d71d8 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 20 Jan 2022 17:28:38 +0100 Subject: [PATCH] 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. --- common/flatpak-context.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/flatpak-context.c b/common/flatpak-context.c index 34510c15..423212dc 100644 --- a/common/flatpak-context.c +++ b/common/flatpak-context.c @@ -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;