find-backports: Exits while checking for commits from stable
While trying to backport the Bluetooth subsystem to RHEL9, I ran into find-backports
just exit'ing after printing Checking for commits from stable...
.
The problem stems from this constructs:
echo Checking for commits from stable... >&2
git log --no-merges --pretty=format:%H -E -i --grep 'upstream commit [[:xdigit:]]{40}|commit[[:space:]]+[[:xdigit:]]{40}[[:space:]]+upstream\.?' "$BASE".."$TARGET" > "$STABLE_LIST"
grep -f "$STABLE_LIST" "$COMMITS_LIST" > "$TMP"
if [ "$?" -eq 0 ]; then
[...]
The problem is that the top of the script also has the line set -e
.
So if that grep
fails, find-backports
will exit without even checking for the retval.
The expedited way to fix this would be to unset -e
/set -e
around the grep call. I checked, and this is the only retval check in the codebase.
Regression added in 17be31b9, so CC: @alex.williamson