From 7ba1a9b46fd07e46dd832b4e6ad5c52283d8830f Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 29 May 2014 14:57:55 -0400 Subject: [PATCH] compose-tree: Fix location of rpmdb querying for caching We were just repeatedly hitting the cache...oops. Also add an assertion that the returned data isn't empty. --- src/rpmostree-compose-builtin-tree.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rpmostree-compose-builtin-tree.c b/src/rpmostree-compose-builtin-tree.c index 50fc1354..325ebf97 100644 --- a/src/rpmostree-compose-builtin-tree.c +++ b/src/rpmostree-compose-builtin-tree.c @@ -783,7 +783,7 @@ compute_checksum_for_compose (JsonObject *treefile_rootval, { int estatus; /* Ugly but it works... */ - gs_free char *rpmqa_shell = g_strdup_printf ("rpm --dbpath=%s/usr/share/rpm | sort -u", + gs_free char *rpmqa_shell = g_strdup_printf ("rpm --dbpath=%s/var/lib/rpm -qa | sort -u", gs_file_get_path_cached (yumroot)); const char *rpmqa_argv[] = { "/bin/sh", "-c", rpmqa_shell, NULL }; gs_free char *rpmqa_result = NULL; @@ -794,6 +794,13 @@ compute_checksum_for_compose (JsonObject *treefile_rootval, goto out; if (!g_spawn_check_exit_status (estatus, error)) goto out; + + if (!*rpmqa_result) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "Empty result from %s", rpmqa_shell); + goto out; + } g_checksum_update (checksum, (guint8*)rpmqa_result, strlen (rpmqa_result)); }