From 8c3b69ccaf7d447324e33d97ee039fcaabb04544 Mon Sep 17 00:00:00 2001 From: Ludovico de Nittis <ludovico.denittis@collabora.com> Date: Tue, 5 Jan 2021 16:08:58 +0100 Subject: [PATCH] pressure-vessel: Start to use the "info" log level Now that we have the ability to set the log level to "info", this commit promotes, from the debug level, all the messages that can be useful to have, for debugging purposes, but that are not too lousy. Over time, when we also gain more first hand experience with the issue reports that users provide, we can tweak the log messages even more. Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com> --- pressure-vessel/adverb.c | 19 ++++++---- pressure-vessel/launch.c | 4 +- pressure-vessel/launcher.c | 8 ++-- pressure-vessel/runtime.c | 77 +++++++++++++++++++------------------- pressure-vessel/wrap.c | 22 +++++------ 5 files changed, 66 insertions(+), 64 deletions(-) diff --git a/pressure-vessel/adverb.c b/pressure-vessel/adverb.c index fa03a1f1c..0a0f505df 100644 --- a/pressure-vessel/adverb.c +++ b/pressure-vessel/adverb.c @@ -462,7 +462,7 @@ generate_locales (gchar **locpath_out, { /* locale-gen exits 72 (EX_OSFILE) if it had to correct for * missing locales at OS level. This is not an error. */ - g_debug ("pressure-vessel-locale-gen created missing locales"); + g_info ("pressure-vessel-locale-gen created missing locales"); } else if (!g_spawn_check_exit_status (wait_status, error)) { @@ -476,7 +476,7 @@ generate_locales (gchar **locpath_out, if (dir == NULL || g_dir_read_name (dir) == NULL) { - g_debug ("No locales have been generated"); + g_info ("No locales have been generated"); return TRUE; } @@ -812,12 +812,12 @@ main (int argc, } else if (locales_temp_dir != NULL) { - g_debug ("Generated locales in %s", locales_temp_dir); + g_info ("Generated locales in %s", locales_temp_dir); flatpak_bwrap_set_env (wrapped_command, "LOCPATH", locales_temp_dir, TRUE); } else { - g_debug ("No locales were missing"); + g_info ("No locales were missing"); } } @@ -917,18 +917,21 @@ main (int argc, if (WIFEXITED (wait_status)) { ret = WEXITSTATUS (wait_status); - g_debug ("Command exited with status %d", ret); + if (ret == 0) + g_debug ("Command exited with status %d", ret); + else + g_info ("Command exited with status %d", ret); } else if (WIFSIGNALED (wait_status)) { ret = 128 + WTERMSIG (wait_status); - g_debug ("Command killed by signal %d", ret - 128); + g_info ("Command killed by signal %d", ret - 128); } else { ret = EX_SOFTWARE; - g_debug ("Command terminated in an unknown way (wait status %d)", - wait_status); + g_info ("Command terminated in an unknown way (wait status %d)", + wait_status); } if (opt_terminate_idle_timeout < 0.0) diff --git a/pressure-vessel/launch.c b/pressure-vessel/launch.c index 1e8a34cf4..e3935d9f4 100644 --- a/pressure-vessel/launch.c +++ b/pressure-vessel/launch.c @@ -239,11 +239,11 @@ forward_signal (int sig) -1, NULL, &error); if (error) - g_debug ("Failed to forward signal: %s", error->message); + g_info ("Failed to forward signal: %s", error->message); if (sig == SIGSTOP) { - g_debug ("SIGSTOP:ing myself"); + g_info ("SIGSTOP:ing myself"); raise (SIGSTOP); } } diff --git a/pressure-vessel/launcher.c b/pressure-vessel/launcher.c index 82cb4d966..1a859d54c 100644 --- a/pressure-vessel/launcher.c +++ b/pressure-vessel/launcher.c @@ -267,7 +267,7 @@ handle_launch (PvLauncher1 *object, g_variant_lookup (arg_options, "terminate-after", "b", &terminate_after); - g_debug ("Running spawn command %s", arg_argv[0]); + g_info ("Running spawn command %s", arg_argv[0]); n_fds = 0; if (fds != NULL) @@ -364,8 +364,8 @@ handle_launch (PvLauncher1 *object, { const gchar *locked_val = g_environ_getenv (env, var); if (g_strcmp0 (val, locked_val) != 0) - g_debug ("Ignoring request to set %s=\"%s\" because it was locked to \"%s\"", - var, val, locked_val ? locked_val : "<unset>"); + g_info ("Ignoring request to set %s=\"%s\" because it was locked to \"%s\"", + var, val, locked_val ? locked_val : "<unset>"); continue; } @@ -384,7 +384,7 @@ handle_launch (PvLauncher1 *object, { const gchar *locked_val = g_environ_getenv (env, unset_env[i]); if (locked_val != NULL) - g_debug ("Ignoring request to unset %s because it was locked to \"%s\"", + g_info ("Ignoring request to unset %s because it was locked to \"%s\"", unset_env[i], locked_val); continue; } diff --git a/pressure-vessel/runtime.c b/pressure-vessel/runtime.c index b8e245a32..8604359c6 100644 --- a/pressure-vessel/runtime.c +++ b/pressure-vessel/runtime.c @@ -313,7 +313,7 @@ runtime_architecture_init (RuntimeArchitecture *self, if (self->ld_so == NULL) { - g_debug ("Cannot determine ld.so for %s", self->details->tuple); + g_info ("Cannot determine ld.so for %s", self->details->tuple); return FALSE; } @@ -608,9 +608,9 @@ pv_runtime_garbage_collect (PvRuntime *self, if (temp_lock == NULL) { - g_debug ("Ignoring \"%s/%s\": unable to get lock: %s", - self->mutable_parent, dent->d_name, - local_error->message); + g_info ("Not deleting \"%s/%s\": unable to get lock: %s", + self->mutable_parent, dent->d_name, + local_error->message); g_clear_error (&local_error); continue; } @@ -1223,8 +1223,8 @@ pv_runtime_provide_container_access (PvRuntime *self, * * In particular, if we are working with a writeable copy of a runtime * that we are editing in-place, it's always like that. */ - g_debug ("%s: Setting up runtime without using bwrap", - G_STRFUNC); + g_info ("%s: Setting up runtime without using bwrap", + G_STRFUNC); self->container_access_adverb = flatpak_bwrap_new (NULL); self->container_access = g_strdup (self->runtime_files); @@ -1259,8 +1259,8 @@ pv_runtime_provide_container_access (PvRuntime *self, /* Otherwise, will we need to use bwrap to build a directory hierarchy * that is the same shape as the final system. */ - g_debug ("%s: Using bwrap to set up runtime that is just /usr", - G_STRFUNC); + g_info ("%s: Using bwrap to set up runtime that is just /usr", + G_STRFUNC); /* By design, writeable copies of the runtime never need this: * the writeable copy is a complete sysroot, not just a merged /usr. */ @@ -1487,7 +1487,7 @@ bind_icd (PvRuntime *self, g_return_val_if_fail (use_numbered_subdirs != NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - g_debug ("Capturing loadable module: %s", details->resolved_library); + g_info ("Capturing loadable module: %s", details->resolved_library); in_current_namespace = g_build_filename (arch->libdir_in_current_namespace, subdir, NULL); @@ -2652,8 +2652,8 @@ collect_vulkan_layers (PvRuntime *self, SRT_LIBRARY_ISSUES_UNKNOWN | SRT_LIBRARY_ISSUES_TIMEOUT)) { - g_debug ("Unable to load library %s: %s", details->resolved_library, - srt_library_get_messages (library)); + g_info ("Unable to load library %s: %s", details->resolved_library, + srt_library_get_messages (library)); continue; } g_free (details->resolved_library); @@ -2662,8 +2662,8 @@ collect_vulkan_layers (PvRuntime *self, else { /* Sorry, we can't know how to load this. */ - g_debug ("Cannot support ld.so special tokens, e.g. ${LIB}, when provider " - "is not the root filesystem"); + g_info ("Cannot support ld.so special tokens, e.g. ${LIB}, when provider " + "is not the root filesystem"); continue; } } @@ -2940,9 +2940,9 @@ pv_runtime_collect_libc_family (PvRuntime *self, if (!found) { - g_debug ("We were expecting to have the gconv modules directory in the " - "provider to be located in \"%s/gconv\", but instead it is missing", - dir); + g_info ("We were expecting the gconv modules directory in the provider " + "to be located in \"%s/gconv\", but instead it is missing", + dir); } } @@ -2994,10 +2994,9 @@ pv_runtime_collect_libdrm_data (PvRuntime *self, } else { - g_debug ("We were expecting to have the libdrm directory " - "in the provider to be located in " - "\"%s/share/libdrm\", but instead it is missing", - dir); + g_info ("We were expecting the libdrm directory in the provider to " + "be located in \"%s/share/libdrm\", but instead it is " + "missing", dir); } } } @@ -3232,14 +3231,14 @@ pv_runtime_use_provider_graphics_stack (PvRuntime *self, if (!srt_egl_icd_check_error (icd, &local_error)) { - g_debug ("Failed to load EGL ICD #%" G_GSIZE_FORMAT " from %s: %s", - j, path, local_error->message); + g_info ("Failed to load EGL ICD #%" G_GSIZE_FORMAT " from %s: %s", + j, path, local_error->message); g_clear_error (&local_error); continue; } - g_debug ("EGL ICD #%" G_GSIZE_FORMAT " at %s: %s", - j, path, srt_egl_icd_get_library_path (icd)); + g_info ("EGL ICD #%" G_GSIZE_FORMAT " at %s: %s", + j, path, srt_egl_icd_get_library_path (icd)); g_ptr_array_add (egl_icd_details, icd_details_new (icd)); } @@ -3262,14 +3261,14 @@ pv_runtime_use_provider_graphics_stack (PvRuntime *self, if (!srt_vulkan_icd_check_error (icd, &local_error)) { - g_debug ("Failed to load Vulkan ICD #%" G_GSIZE_FORMAT " from %s: %s", - j, path, local_error->message); + g_info ("Failed to load Vulkan ICD #%" G_GSIZE_FORMAT " from %s: %s", + j, path, local_error->message); g_clear_error (&local_error); continue; } - g_debug ("Vulkan ICD #%" G_GSIZE_FORMAT " at %s: %s", - j, path, srt_vulkan_icd_get_library_path (icd)); + g_info ("Vulkan ICD #%" G_GSIZE_FORMAT " at %s: %s", + j, path, srt_vulkan_icd_get_library_path (icd)); g_ptr_array_add (vulkan_icd_details, icd_details_new (icd)); } @@ -3292,14 +3291,14 @@ pv_runtime_use_provider_graphics_stack (PvRuntime *self, if (!srt_vulkan_layer_check_error (layer, &local_error)) { - g_debug ("Failed to load Vulkan Layer #%" G_GSIZE_FORMAT " from %s: %s", - j, path, local_error->message); + g_info ("Failed to load Vulkan explicit layer #%" G_GSIZE_FORMAT + " from %s: %s", j, path, local_error->message); g_clear_error (&local_error); continue; } - g_debug ("Vulkan explicit layer #%" G_GSIZE_FORMAT " at %s: %s", - j, path, srt_vulkan_layer_get_library_path (layer)); + g_info ("Vulkan explicit layer #%" G_GSIZE_FORMAT " at %s: %s", + j, path, srt_vulkan_layer_get_library_path (layer)); g_ptr_array_add (vulkan_exp_layer_details, icd_details_new (layer)); } @@ -3321,16 +3320,16 @@ pv_runtime_use_provider_graphics_stack (PvRuntime *self, if (!srt_vulkan_layer_check_error (layer, &local_error)) { - g_debug ("Failed to load Vulkan Layer #%" G_GSIZE_FORMAT " from %s: %s", - j, path, local_error->message); + g_info ("Failed to load Vulkan implicit layer #%" G_GSIZE_FORMAT + " from %s: %s", j, path, local_error->message); g_clear_error (&local_error); continue; } library_path = srt_vulkan_layer_get_library_path (layer); - g_debug ("Vulkan implicit layer #%" G_GSIZE_FORMAT " at %s: %s", - j, path, library_path != NULL ? library_path : "meta-layer"); + g_info ("Vulkan implicit layer #%" G_GSIZE_FORMAT " at %s: %s", + j, path, library_path != NULL ? library_path : "meta-layer"); g_ptr_array_add (vulkan_imp_layer_details, icd_details_new (layer)); } @@ -3368,9 +3367,9 @@ pv_runtime_use_provider_graphics_stack (PvRuntime *self, if (ld_so_in_runtime == NULL) { - g_debug ("Container does not have %s so it cannot run " - "%s binaries", - arch->ld_so, arch->details->tuple); + g_info ("Container does not have %s so it cannot run " + "%s binaries", + arch->ld_so, arch->details->tuple); continue; } diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c index 768102c7d..5a06c4cc3 100644 --- a/pressure-vessel/wrap.c +++ b/pressure-vessel/wrap.c @@ -436,17 +436,17 @@ bind_and_propagate_from_environ (FlatpakExports *exports, if (!g_file_test (values[i], G_FILE_TEST_EXISTS)) { - g_debug ("Not bind-mounting %s=\"%s%s%s\" because it does not exist", - variable, before, values[i], after); + g_info ("Not bind-mounting %s=\"%s%s%s\" because it does not exist", + variable, before, values[i], after); continue; } canon = g_canonicalize_filename (values[i], NULL); value_host = pv_current_namespace_path_to_host_path (canon); - g_debug ("Bind-mounting %s=\"%s%s%s\" from the current env as %s=\"%s%s%s\" in the host", - variable, before, values[i], after, - variable, before, value_host, after); + g_info ("Bind-mounting %s=\"%s%s%s\" from the current env as %s=\"%s%s%s\" in the host", + variable, before, values[i], after, + variable, before, value_host, after); flatpak_exports_add_path_expose (exports, mode, canon); if (strcmp (values[i], value_host) != 0) @@ -1826,7 +1826,7 @@ main (int argc, if (opt_remove_game_overlay && g_str_has_suffix (preload, "/gameoverlayrenderer.so")) { - g_debug ("Disabling Steam Overlay: %s", preload); + g_info ("Disabling Steam Overlay: %s", preload); continue; } @@ -1853,7 +1853,7 @@ main (int argc, } else { - g_debug ("LD_PRELOAD module '%s' does not exist", preload); + g_info ("LD_PRELOAD module '%s' does not exist", preload); } } } @@ -1883,7 +1883,7 @@ main (int argc, /* We already checked this */ g_assert (g_path_is_absolute (opt_filesystems[i])); - g_debug ("Bind-mounting \"%s\"", opt_filesystems[i]); + g_info ("Bind-mounting \"%s\"", opt_filesystems[i]); flatpak_exports_add_path_expose (exports, FLATPAK_FILESYSTEM_MODE_READ_WRITE, opt_filesystems[i]); @@ -1898,9 +1898,9 @@ main (int argc, if (_srt_is_same_file (home, cwd_p)) { - g_debug ("Not making physical working directory \"%s\" available to " - "container because it is the home directory", - cwd_p); + g_info ("Not making physical working directory \"%s\" available to " + "container because it is the home directory", + cwd_p); } else { -- GitLab