bin/pull: Fix @ override syntax when pulling multiple refs
Coverity spotted an infloop here since we were incrementing `i++` instead of `j++`. But adding a test revealed other bugs - we need to keep the arrays in sync. Coverity CID: 1452204 Closes: #1041 Approved by: pwithnall
This commit is contained in:
parent
8eec337fee
commit
48f8f32921
|
|
@ -209,11 +209,13 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (!override_commit_ids)
|
if (!override_commit_ids)
|
||||||
override_commit_ids = g_ptr_array_new_with_free_func (g_free);
|
{
|
||||||
|
override_commit_ids = g_ptr_array_new_with_free_func (g_free);
|
||||||
|
|
||||||
/* Backfill */
|
/* Backfill */
|
||||||
for (j = 2; j < i; i++)
|
for (j = 2; j < i; j++)
|
||||||
g_ptr_array_add (override_commit_ids, g_strdup (""));
|
g_ptr_array_add (override_commit_ids, g_strdup (""));
|
||||||
|
}
|
||||||
|
|
||||||
g_ptr_array_add (override_commit_ids, g_strdup (override_commit_id));
|
g_ptr_array_add (override_commit_ids, g_strdup (override_commit_id));
|
||||||
g_ptr_array_add (refs_to_fetch, g_strndup (argv[i], at - argv[i]));
|
g_ptr_array_add (refs_to_fetch, g_strndup (argv[i], at - argv[i]));
|
||||||
|
|
@ -221,6 +223,8 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_ptr_array_add (refs_to_fetch, g_strdup (argv[i]));
|
g_ptr_array_add (refs_to_fetch, g_strdup (argv[i]));
|
||||||
|
if (override_commit_ids)
|
||||||
|
g_ptr_array_add (override_commit_ids, g_strdup (""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ function verify_initial_contents() {
|
||||||
assert_file_has_content baz/cow '^moo$'
|
assert_file_has_content baz/cow '^moo$'
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "1..27"
|
echo "1..28"
|
||||||
|
|
||||||
# Try both syntaxes
|
# Try both syntaxes
|
||||||
repo_init --no-gpg-verify
|
repo_init --no-gpg-verify
|
||||||
|
|
@ -364,6 +364,10 @@ assert_not_has_file baz/saucer
|
||||||
|
|
||||||
echo "ok static delta 2"
|
echo "ok static delta 2"
|
||||||
|
|
||||||
|
cd ${test_tmpdir}
|
||||||
|
${CMD_PREFIX} ostree --repo=repo pull origin main main@${rev} main@${rev} main main@${rev} main
|
||||||
|
echo "ok pull specific commit array"
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
cd ${test_tmpdir}
|
||||||
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false --set=unconfigured-state="Access to ExampleOS requires ONE BILLION DOLLARS." origin-subscription file://$(pwd)/ostree-srv/gnomerepo
|
${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false --set=unconfigured-state="Access to ExampleOS requires ONE BILLION DOLLARS." origin-subscription file://$(pwd)/ostree-srv/gnomerepo
|
||||||
if ${CMD_PREFIX} ostree --repo=repo pull origin-subscription main 2>err.txt; then
|
if ${CMD_PREFIX} ostree --repo=repo pull origin-subscription main 2>err.txt; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue