Merge lp:~xnox/britney/do-not-carry-on-after-git-fail into lp:~ubuntu-release/britney/britney1-ubuntu

Proposed by Dimitri John Ledkov
Status: Needs review
Proposed branch: lp:~xnox/britney/do-not-carry-on-after-git-fail
Merge into: lp:~ubuntu-release/britney/britney1-ubuntu
Diff against target: 24 lines (+6/-1)
1 file modified
britney (+6/-1)
To merge this branch: bzr merge lp:~xnox/britney/do-not-carry-on-after-git-fail
Reviewer Review Type Date Requested Status
Ubuntu Release Team Pending
Review via email: mp+401705@code.launchpad.net

Commit message

currently when make_hints_git fails, echo prints an error message and the function returns success, because echo was a success.

britney carries on, and potentially migrates things without taking hints into account.

Do not eat errors from subshell, and in addition to printing error message, also return failure from the make_hints_git() function.

Tested this by running make_hints_git function alone with a valid & invalid branches under set -e, to ensure that script doesn't carry on after make_hints_git fails.

This should fix impish opening error that cause many unintended packages to be copied from -proposed to release. https://people.canonical.com/~ubuntu-archive/proposed-migration/log/impish/2021-04-23/11:25:13.log

To post a comment you must log in.
348. By Dimitri John Ledkov

britney: do not eat error code from make_hints_git

At impish opening, make_hints_git failed to download/checkout any
hints, printed an error message, and carried on to process and copy
all the things from -proposed to -release, even though there was block
all sources hint in devel branch (but britney did not yet know that it
should use devel for impish).

See https://people.canonical.com/~ubuntu-archive/proposed-migration/log/impish/2021-04-23/11:25:13.log

Unmerged revisions

348. By Dimitri John Ledkov

britney: do not eat error code from make_hints_git

At impish opening, make_hints_git failed to download/checkout any
hints, printed an error message, and carried on to process and copy
all the things from -proposed to -release, even though there was block
all sources hint in devel branch (but britney did not yet know that it
should use devel for impish).

See https://people.canonical.com/~ubuntu-archive/proposed-migration/log/impish/2021-04-23/11:25:13.log

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'britney'
2--- britney 2020-10-29 10:39:07 +0000
3+++ britney 2021-04-23 13:58:48 +0000
4@@ -333,6 +333,7 @@
5
6 make_hints_git () {
7 ! [ -d "$1" ] && mkdir "$1"
8+ ret=0
9 (
10 cd "$1" || exit 1
11 if ! [ -d .git ]; then
12@@ -346,7 +347,11 @@
13 git checkout --force --track -b "$3" "origin/$3"
14 else
15 git reset --hard "origin/$3"
16- fi) || echo "ERROR: make_hints_git failed -- directory=$1 url=$2" 1>&2
17+ fi) || ret=$?
18+ if [ "$ret" != "0" ]; then
19+ echo "ERROR: make_hints_git failed -- directory=$1 url=$2" 1>&2
20+ fi
21+ return $ret
22 }
23
24 sanitise_hints_kernel () {

Subscribers

People subscribed via source and target branches