Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Jill Ravaliya <jillravaliya@gmail.com>
To: masahiroy@kernel.org
Cc: linux-kbuild@vger.kernel.org, nathan@kernel.org,
	nicolas@fjasle.eu, Jill Ravaliya <jillravaliya@gmail.com>
Subject: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
Date: Fri,  1 May 2026 06:50:18 +0530	[thread overview]
Message-ID: <20260501012018.43278-1-jillravaliya@gmail.com> (raw)
In-Reply-To: <CAHr0PbumU-Y4G9rmuffd3crfOpqgxvQii0cVEYFC_sdjjNEZRw@mail.gmail.com>

The 'builddeb' script generates maintainer scripts for Debian-based
distributions. Currently, it invokes post-installation hooks via
run-parts but unconditionally exits with code 0. This masks failures
from downstream hooks (e.g., initramfs generation or DKMS).

On systems with modular storage drivers (CONFIG_BLK_DEV_NVME=m), an
unnoticed failure in an early hook can prevent the initrd from being
correctly updated, leading to a panic on reboot.

This patch ensures that failures in 'run-parts' are correctly
propagated, allowing the package manager to abort the installation
upon hook failure.

Signed-off-by: Jill Ravaliya <jillravaliya@gmail.com>
Link: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2141741

---
v3:
  - Fix variable escaping in run-parts invocation
  - Fix indentation to use tabs consistently
  - Fix Signed-off-by name formatting

v2:
  - Resending via git send-email to fix formatting issues.
  - Refined commit message for clarity and professional tone.
---
 scripts/package/builddeb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 3627ca227..21c929dd3 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -98,7 +98,12 @@ install_maint_scripts () {
 			hookdirs="\$hookdirs \$dir/${script}.d"
 		done
 		hookdirs="\${hookdirs# }"
-		test -n "\$hookdirs" && run-parts --arg="${KERNELRELEASE}" --arg="/${installed_image_path}" \$hookdirs
+		if [ -n "\$hookdirs" ]; then
+			if ! run-parts --arg="${KERNELRELEASE}" --arg="/${installed_image_path}" \$hookdirs; then
+				echo "E: Post-install hooks failed." >&2
+				exit 1
+			fi
+		fi
 		exit 0
 		EOF
 		chmod 755 "${pdir}/DEBIAN/${script}"
-- 
2.51.1


  parent reply	other threads:[~2026-05-01  1:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22 18:30 [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb Jill Ravaliya
2026-04-22 22:06 ` Nathan Chancellor
2026-04-30  8:54 ` Jill Ravaliya
2026-04-30 22:52   ` Nathan Chancellor
2026-05-01  1:20 ` Jill Ravaliya [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-05-08 10:18 Jill Ravaliya
2026-05-08 10:27 Jill Ravaliya
2026-05-08 12:01 ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260501012018.43278-1-jillravaliya@gmail.com \
    --to=jillravaliya@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox