From 287cd09c7a0056fec8616e01608e9f9c1bb8e07c Mon Sep 17 00:00:00 2001 From: Seth Forshee Date: Mon, 25 Nov 2019 15:34:00 +0100 Subject: [PATCH] UBUNTU: [Debian] Fix warnings when checking for modules signatures BugLink: https://bugs.launchpad.net/bugs/1853843 When detecting module signatures, the current approach causes this warning for modules lacking a signature: /bin/bash: line 5: warning: command substitution: ignored null byte in input My original approach used read, which works well, but for unknown reasons causes an error from bash when by itself as the first line in the if clause. Putting it in a no-op while loop prevents the error, but it has the advantage of working without flooding the build logs with warnings. Signed-off-by: Seth Forshee Acked-by: Kleber Sacilotto de Souza Acked-by: Stefan Bader Signed-off-by: Kleber Sacilotto de Souza --- debian/rules.d/2-binary-arch.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index cf2c1f0d58b81..3bc508717e9da 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -413,12 +413,14 @@ ifneq ($(skipdbg),true) -name '*.ko' | while read path_module ; do \ module="/lib/modules/$${path_module#*/lib/modules/}"; \ if [[ -f "$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \ - signature=$$(tail -c 28 "$$path_module"); \ + while IFS= read -r -d '' signature < <(tail -c 28 "$$path_module"); do \ + break; \ + done; \ $(CROSS_COMPILE)objcopy \ --add-gnu-debuglink=$(dbgpkgdir)/usr/lib/debug/$$module \ $$path_module; \ if grep -q CONFIG_MODULE_SIG=y $(builddir)/build-$*/.config && \ - [ "$$signature" = "~Module signature appended~" ]; then \ + [ "$$signature" = $$'~Module signature appended~\n' ]; then \ $(builddir)/build-$*/scripts/sign-file $(MODHASHALGO) \ $(MODSECKEY) \ $(MODPUBKEY) \