diff mbox series

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

Message ID 20230227144953.935987-4-dimitri.ledkov@canonical.com
State New
Headers show
Series [lunar:linux,lunar:linux-unstable,v2,1/3] UBUNTU: [Packaging] Support skipped dkms modules | expand

Commit Message

Dimitri John Ledkov Feb. 27, 2023, 2:49 p.m. UTC
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@canonical.com>
---
 debian/scripts/dkms-build--nvidia-N | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

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 "$?"
+)