Don't pass non-checksums to ostree_repo_has_object()
The 'ostree show' command passed non-checksum arguments to the ostree_repo_has_object() function which led to an assertion. https://bugzilla.gnome.org/show_bug.cgi?id=705967
This commit is contained in:
parent
8c31e6fda7
commit
1904e3e0f4
|
|
@ -143,7 +143,7 @@ do_print_metadata_key (OstreeRepo *repo,
|
||||||
static gboolean
|
static gboolean
|
||||||
print_if_found (OstreeRepo *repo,
|
print_if_found (OstreeRepo *repo,
|
||||||
OstreeObjectType objtype,
|
OstreeObjectType objtype,
|
||||||
const char *rev,
|
const char *checksum,
|
||||||
gboolean *inout_was_found,
|
gboolean *inout_was_found,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
|
|
@ -154,17 +154,17 @@ print_if_found (OstreeRepo *repo,
|
||||||
if (*inout_was_found)
|
if (*inout_was_found)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (!ostree_repo_has_object (repo, objtype, rev, &have_object,
|
if (!ostree_repo_has_object (repo, objtype, checksum, &have_object,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
if (have_object)
|
if (have_object)
|
||||||
{
|
{
|
||||||
gs_unref_variant GVariant *variant = NULL;
|
gs_unref_variant GVariant *variant = NULL;
|
||||||
if (!ostree_repo_load_variant (repo, objtype, rev,
|
if (!ostree_repo_load_variant (repo, objtype, checksum,
|
||||||
&variant, error))
|
&variant, error))
|
||||||
goto out;
|
goto out;
|
||||||
*inout_was_found = TRUE;
|
*inout_was_found = TRUE;
|
||||||
g_print ("Object: %s\nType: %s\n", rev, ostree_object_type_to_string (objtype));
|
g_print ("Object: %s\nType: %s\n", checksum, ostree_object_type_to_string (objtype));
|
||||||
print_variant (variant);
|
print_variant (variant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -223,7 +223,7 @@ ostree_builtin_show (int argc, char **argv, GFile *repo_path, GCancellable *canc
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
if (!ostree_validate_rev (rev, NULL))
|
if (!ostree_validate_checksum_string (rev, NULL))
|
||||||
{
|
{
|
||||||
gs_unref_variant GVariant *variant = NULL;
|
gs_unref_variant GVariant *variant = NULL;
|
||||||
if (!ostree_repo_resolve_rev (repo, rev, FALSE, &resolved_rev, error))
|
if (!ostree_repo_resolve_rev (repo, rev, FALSE, &resolved_rev, error))
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "1..35"
|
echo "1..36"
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
|
|
@ -245,3 +245,6 @@ cd ${test_tmpdir}
|
||||||
$OSTREE ls test2
|
$OSTREE ls test2
|
||||||
echo "ok ls with no argument"
|
echo "ok ls with no argument"
|
||||||
|
|
||||||
|
cd ${test_tmpdir}
|
||||||
|
$OSTREE show test2
|
||||||
|
echo "ok show with non-checksum"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue