From bc5f6371e9ac441caf6844c157cf4dda62a9fbbb Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 13 Jul 2020 15:06:54 +0200 Subject: [PATCH] app: add contents of /.flatpak-info in the verbose info. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file is available in a flatpak sandbox and will contain various info such as the build commit, very useful info as we can have several builds for a same version. For instance if we have exactly the right commit, we can load exactly the same binary as a bug reporter very easily, hence are able to get source correspondance without necessarily asking reporters to install debug symbols (though it stays easier if they can do it). Other interesting info contained in this file are the exact runtime used, the installed application or runtime extensions, the permissions (people may override our flatpak permissions so it's useful to be able to check when they did) and environment variables… --- app/gimp-version.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/gimp-version.c b/app/gimp-version.c index 3d1894a036..6e311c8252 100644 --- a/app/gimp-version.c +++ b/app/gimp-version.c @@ -220,6 +220,7 @@ gimp_version (gboolean be_verbose, { gchar *verbose_info; gchar *lib_versions; + gchar *flatpak_info = NULL; lib_versions = gimp_library_versions (localized); verbose_info = g_strdup_printf ("git-describe: %s\n" @@ -234,9 +235,22 @@ gimp_version (gboolean be_verbose, lib_versions); g_free (lib_versions); - temp = g_strconcat (version, verbose_info, NULL); + /* This file should be available at root path in a flatpak + * environment. Just add its contents to the verbose output if it + * exists. Silently ignore otherwise. + */ + if (g_file_get_contents ("/.flatpak-info", &flatpak_info, NULL, NULL)) + { + temp = g_strdup_printf ("\n# Flatpak info #\n%s", + flatpak_info); + g_free (flatpak_info); + flatpak_info = temp; + } + temp = g_strconcat (version, verbose_info, flatpak_info, NULL); g_free (version); g_free (verbose_info); + g_free (flatpak_info); + version = temp; }