From 1978d82cbfb804c273c06cb6aba35818e542e847 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 3 Oct 2017 19:17:13 +0100 Subject: [PATCH] Add some post-release bug fix patches --- debian/changelog | 1 + ...on-with-pull-local-for-nonexistent-r.patch | 90 +++++++++++++++++++ ...t-detached-metadata-even-if-hardlink.patch | 30 +++++++ debian/patches/series | 2 + 4 files changed, 123 insertions(+) create mode 100644 debian/patches/2017.13/lib-pull-Fix-regression-with-pull-local-for-nonexistent-r.patch create mode 100644 debian/patches/2017.13/lib-repo-commit-Import-detached-metadata-even-if-hardlink.patch create mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index cadb655c..c18ad73b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ ostree (2017.12-1) UNRELEASED; urgency=medium * New upstream release - Drop all current patches, applied upstream - Update symbols file + * Add some post-release bug fix patches -- Simon McVittie Tue, 03 Oct 2017 19:14:14 +0100 diff --git a/debian/patches/2017.13/lib-pull-Fix-regression-with-pull-local-for-nonexistent-r.patch b/debian/patches/2017.13/lib-pull-Fix-regression-with-pull-local-for-nonexistent-r.patch new file mode 100644 index 00000000..5e66dd93 --- /dev/null +++ b/debian/patches/2017.13/lib-pull-Fix-regression-with-pull-local-for-nonexistent-r.patch @@ -0,0 +1,90 @@ +From: Colin Walters +Date: Mon, 2 Oct 2017 11:24:05 -0400 +Subject: lib/pull: Fix regression with pull-local for nonexistent refs + +I was reading the pull code for the last release, and spotted +a bug in commit f923c2e1eaebe0c781f07d34ae1a03f94357bccd - in +the case where the ref doesn't exist, we don't set an error, +tripping an assertion in the main code. + +The previous code wanted the ref to always exist, so just flip back the boolean +for "ignore noent". I moved the `g_strchomp()` just into the HTTP path - if a +local repo is corrupted in this way it's something to fix in that repo. + +Closes: #1238 +Approved by: pwithnall +Origin: upstream, 2017.13, commit:b8c15ae859de7a353b99c98c6266ee626cd94e7e +--- + src/libostree/ostree-repo-pull.c | 13 ++++++------- + tests/pull-test.sh | 10 +++++++++- + 2 files changed, 15 insertions(+), 8 deletions(-) + +diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c +index 8a699ca..d5062e0 100644 +--- a/src/libostree/ostree-repo-pull.c ++++ b/src/libostree/ostree-repo-pull.c +@@ -844,7 +844,7 @@ fetch_ref_contents (OtPullData *pull_data, + { + #ifdef OSTREE_ENABLE_EXPERIMENTAL_API + if (!ostree_repo_resolve_collection_ref (pull_data->remote_repo_local, +- ref, TRUE /* ignore enoent */, ++ ref, FALSE, + OSTREE_REPO_RESOLVE_REV_EXT_NONE, + &ret_contents, cancellable, error)) + return FALSE; +@@ -855,7 +855,7 @@ fetch_ref_contents (OtPullData *pull_data, + else if (pull_data->remote_repo_local != NULL) + { + if (!ostree_repo_resolve_rev_ext (pull_data->remote_repo_local, +- ref->ref_name, TRUE /* ignore enoent */, ++ ref->ref_name, FALSE, + OSTREE_REPO_RESOLVE_REV_EXT_NONE, + &ret_contents, error)) + return FALSE; +@@ -874,14 +874,13 @@ fetch_ref_contents (OtPullData *pull_data, + filename, &ret_contents, + cancellable, error)) + return FALSE; ++ ++ g_strchomp (ret_contents); + } + +- /* Validate and return. */ +- if (ret_contents != NULL) +- g_strchomp (ret_contents); ++ g_assert (ret_contents); + +- if (ret_contents == NULL || +- !ostree_validate_checksum_string (ret_contents, error)) ++ if (!ostree_validate_checksum_string (ret_contents, error)) + return glnx_prefix_error (error, "Fetching checksum for ref (%s, %s)", + ref->collection_id ? ref->collection_id : "(empty)", + ref->ref_name); +diff --git a/tests/pull-test.sh b/tests/pull-test.sh +index 7d4b57f..2afc0ac 100644 +--- a/tests/pull-test.sh ++++ b/tests/pull-test.sh +@@ -35,7 +35,7 @@ function verify_initial_contents() { + assert_file_has_content baz/cow '^moo$' + } + +-echo "1..31" ++echo "1..32" + + # Try both syntaxes + repo_init --no-gpg-verify +@@ -238,6 +238,14 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo-local rev-parse localbranch + ${CMD_PREFIX} ostree --repo=mirrorrepo-local fsck + echo "ok pull-local mirror errors with mixed refs" + ++rm -f otherrepo/summary ++if ${CMD_PREFIX} ostree --repo=mirrorrepo-local pull-local otherrepo nosuchbranch 2>err.txt; then ++ fatal "pulled nonexistent branch" ++fi ++# So true ++assert_file_has_content_literal err.txt "error: Refspec 'nosuchbranch' not found" ++echo "ok pull-local nonexistent branch" ++ + cd ${test_tmpdir} + ${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b main -s "Metadata string" --add-detached-metadata-string=SIGNATURE=HANCOCK --tree=ref=main + ${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u diff --git a/debian/patches/2017.13/lib-repo-commit-Import-detached-metadata-even-if-hardlink.patch b/debian/patches/2017.13/lib-repo-commit-Import-detached-metadata-even-if-hardlink.patch new file mode 100644 index 00000000..1cded202 --- /dev/null +++ b/debian/patches/2017.13/lib-repo-commit-Import-detached-metadata-even-if-hardlink.patch @@ -0,0 +1,30 @@ +From: Philip Withnall +Date: Tue, 3 Oct 2017 15:45:34 +0100 +Subject: lib/repo-commit: Import detached metadata even if hardlink exists + +Spotted while reading through the code, it looks like the +copy_detached_metadata() call is accidentally omitted if a hardlink +already exists for the .commit object. + +Signed-off-by: Philip Withnall + +Closes: #1242 +Approved by: cgwalters +Origin: upstream, 2017.13, commit:86e072bdbe48a4f16efb05c00eb79114e5fdbf61 +--- + src/libostree/ostree-repo-commit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c +index c4484f4..76bc187 100644 +--- a/src/libostree/ostree-repo-commit.c ++++ b/src/libostree/ostree-repo-commit.c +@@ -3255,7 +3255,7 @@ import_one_object_direct (OstreeRepo *dest_repo, + if (linkat (src_repo->objects_dir_fd, loose_path_buf, dest_dfd, loose_path_buf, 0) != 0) + { + if (errno == EEXIST) +- return TRUE; ++ did_hardlink = TRUE; + else if (errno == EMLINK || errno == EXDEV || errno == EPERM) + { + /* EMLINK, EXDEV and EPERM shouldn't be fatal; we just can't do diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 00000000..67272a08 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +2017.13/lib-pull-Fix-regression-with-pull-local-for-nonexistent-r.patch +2017.13/lib-repo-commit-Import-detached-metadata-even-if-hardlink.patch