Skip to content
Snippets Groups Projects
Commit 9be280f5 authored by Simon McVittie's avatar Simon McVittie
Browse files

pv-adverb: Expand error message if we cannot regenerate ld.so cache


We can make it easier to diagnose ldconfig failures by including the
stderr from the failing ldconfig command in our error message.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 53be663f
No related branches found
No related tags found
1 merge request!358pressure-vessel: Fix regression regenerating ld.so.cache on Ubuntu and older Debian
......@@ -638,6 +638,7 @@ regenerate_ld_so_cache (const GPtrArray *ld_so_cache_paths,
const char *dir,
GError **error)
{
g_autoptr(GError) local_error = NULL;
g_autoptr(GPtrArray) argv = g_ptr_array_new ();
g_autoptr(GString) conf = g_string_new ("");
g_autofree gchar *child_stdout = NULL;
......@@ -723,15 +724,34 @@ regenerate_ld_so_cache (const GPtrArray *ld_so_cache_paths,
error))
return glnx_prefix_error (error, "Cannot run /sbin/ldconfig");
if (!g_spawn_check_exit_status (wait_status, &local_error))
{
if (child_stderr != NULL && child_stderr[0] != '\0')
{
g_set_error (error, local_error->domain, local_error->code,
("Unable to generate %s: %s.\n"
"Diagnostic output:\n%s"),
new_path,
local_error->message,
child_stderr);
}
else
{
g_set_error (error, local_error->domain, local_error->code,
"Unable to generate %s: %s",
new_path,
local_error->message);
}
return FALSE;
}
if (child_stdout != NULL && child_stdout[0] != '\0')
g_debug ("Output:\n%s", child_stdout);
if (child_stderr != NULL && child_stderr[0] != '\0')
g_debug ("Diagnostic output:\n%s", child_stderr);
if (!g_spawn_check_exit_status (wait_status, error))
return glnx_prefix_error (error, "Unable to generate %s", new_path);
/* Atomically replace ld.so.cache with new-ld.so.cache. */
if (!glnx_renameat (AT_FDCWD, new_path, AT_FDCWD, replace_path, error))
return glnx_prefix_error (error, "Cannot move %s to %s",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment