From d664ca3ae303191a6e78413455542a2d9b42ce65 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Sun, 8 Nov 2026 12:40:57 -0400 Subject: [PATCH] kernel: write the pruned headers package's md5sums in dpkg's format (#1501 review) The CHANGES verdict on #1501 was right and the PR merged anyway: the regenerated DEBIAN/md5sums carried a './' prefix, which is not what dpkg writes. One sed in the pipeline strips it. Measured on linux-headers-7.4.0-rc1-1bit_7.4.0~rc1-1: before the change the file opened with './usr/src/...' (grep -c '^\./' = N), after it opens with 'usr/src/...' and grep -c '^\./' = 0, matching the same package's original md5sums byte for byte in format. The prune itself is unchanged (4 -> 3 files carrying a build-machine path). --- scripts/prune-kernel-headers-deb.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/prune-kernel-headers-deb.sh b/scripts/prune-kernel-headers-deb.sh index eb0f007e0..c24478e57 100755 --- a/scripts/prune-kernel-headers-deb.sh +++ b/scripts/prune-kernel-headers-deb.sh @@ -43,8 +43,10 @@ before=$(grep -rlE '/home/[a-z]+/' "$hdrs" 2>/dev/null | wc -l) removed=0 while IFS= read -r f; do rm -f "$f"; removed=$((removed+1)); done < <(find "$hdrs/scripts/mod" -maxdepth 1 -name '*.s' 2>/dev/null) [ "$removed" -gt 0 ] || { echo "nothing to prune (no scripts/mod/*.s) - refusing to rewrite the package" >&2; exit 5; } +# dpkg writes this file with paths relative to the package root and no "./" prefix; a leading "./" is not the format +# (caught in review of #1501, where it merged anyway), so strip it rather than emit a file dpkg's own tools parse oddly. rm -f "$work/pkg/DEBIAN/md5sums" -( cd "$work/pkg" && find . -path ./DEBIAN -prune -o -type f -print0 | xargs -0 md5sum > DEBIAN/md5sums ) +( cd "$work/pkg" && find . -path ./DEBIAN -prune -o -type f -print0 | xargs -0 md5sum | sed 's|^\([0-9a-f]*\) \./|\1 |' > DEBIAN/md5sums ) after=$(grep -rlE '/home/[a-z]+/' "$hdrs" 2>/dev/null | wc -l) dpkg-deb --root-owner-group -b "$work/pkg" "$OUT" >/dev/null || { echo "repack failed" >&2; exit 6; } echo "pruned $removed file(s) from $(basename "$hdrs")"