[lunar:linux][lunar:linux-unstable][PATCH v2 3/3] UBUNTU: [Packaging] actually enforce set -e in dkms-build--nvidia-N

Dimitri John Ledkov dimitri.ledkov at canonical.com
Mon Feb 27 14:49:53 UTC 2023


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 <dimitri.ledkov at canonical.com>
---
 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 e295fa259a..383af59327 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 "$?"
+)
-- 
2.34.1




More information about the kernel-team mailing list