From 57467905046b9924b43bb2fdc3ad5fe6b6eaf737 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Mon, 27 Feb 2023 14:49:53 +0000 Subject: [PATCH] UBUNTU: [Packaging] actually enforce set -e in dkms-build--nvidia-N The current code is effectively this: set -e; (false; true) || exit "$?" Due to historical reasons any code inside a pipeline is executed with `set +e` mode effective, meaning false command doesn't return, the rest of commands are executed, and the error code from () is set to the last (usually successful) command. This is the reason, why my previous buggy behaviour despite generating errors inside the dkms-build--nvidia-N didn't abort the build, but happily produced linux-nvidia-objects.deb which contained empty SHA256SUMS file and broken BUILD CLEAN scripts that did nothing. Signed-off-by: Dimitri John Ledkov Signed-off-by: Andrea Righi --- debian/scripts/dkms-build--nvidia-N | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/scripts/dkms-build--nvidia-N b/debian/scripts/dkms-build--nvidia-N index e295fa259a14..383af5932720 100755 --- a/debian/scripts/dkms-build--nvidia-N +++ b/debian/scripts/dkms-build--nvidia-N @@ -61,7 +61,7 @@ sed -e 's/.*-o *\([^ ]*\) .*/rm -f \1/g' <"$pkgdir/bits/BUILD" >"$pkgdir/bits/C # rebuild the .ko's, sign them, pull off the signatures and then finally clean # up again. ( - cd "$pkgdir/bits" || exit 1 + cd "$pkgdir/bits" # Add checksum check. echo "\$check_only sha256sum -c SHA256SUMS || exit 1" >>"$pkgdir/bits/BUILD" @@ -110,4 +110,4 @@ sed -e 's/.*-o *\([^ ]*\) .*/rm -f \1/g' <"$pkgdir/bits/BUILD" >"$pkgdir/bits/C find "$pkgdir" -name \*.sig -prune -o -name SHA256SUMS -prune -o -type f -print | xargs rm -f find "$pkgdir" -depth -type d -print | xargs rmdir --ignore-fail-on-non-empty fi -) || exit "$?" +)