[PATCH][SRU][E/Unstable] UBUNTU: [Debian] Fix warnings when checking for modules signatures

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH][SRU][E/Unstable] UBUNTU: [Debian] Fix warnings when checking for modules signatures

Seth Forshee
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 <[hidden email]>
---

This is the same approach as in the first patch I sent for this. The
no-op while loop is strange, but without it the read genearates an error
that no one has been able to explain. However, so far this is the only
approach I've found that works in both bionic and eoan without spamming
the build log.

 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 070478e010f7..2aea5e857f79 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) \
--
2.24.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH][SRU][E/Unstable] UBUNTU: [Debian] Fix warnings when checking for modules signatures

Kleber Souza
On 25.11.19 15:34, Seth Forshee wrote:

> 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 <[hidden email]>

Thanks for fixing it.

Acked-by: Kleber Sacilotto de Souza <[hidden email]>

> ---
>
> This is the same approach as in the first patch I sent for this. The
> no-op while loop is strange, but without it the read genearates an error
> that no one has been able to explain. However, so far this is the only
> approach I've found that works in both bionic and eoan without spamming
> the build log.
>
>  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 070478e010f7..2aea5e857f79 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) \
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH][SRU][E/Unstable] UBUNTU: [Debian] Fix warnings when checking for modules signatures

Stefan Bader-2
In reply to this post by Seth Forshee
On 25.11.19 15:34, Seth Forshee wrote:

> 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 <[hidden email]>
Acked-by: Stefan Bader <[hidden email]>

> ---
>
> This is the same approach as in the first patch I sent for this. The
> no-op while loop is strange, but without it the read genearates an error
> that no one has been able to explain. However, so far this is the only
> approach I've found that works in both bionic and eoan without spamming
> the build log.
>
>  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 070478e010f7..2aea5e857f79 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) \
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

APPLIED: [PATCH][SRU][E/Unstable] UBUNTU: [Debian] Fix warnings when checking for modules signatures

Kleber Souza
In reply to this post by Seth Forshee
On 2019-11-25 15:34, Seth Forshee wrote:

> 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 <[hidden email]>

Applied to eoan/master-next branch.

Thanks,
Kleber

> ---
>
> This is the same approach as in the first patch I sent for this. The
> no-op while loop is strange, but without it the read genearates an error
> that no one has been able to explain. However, so far this is the only
> approach I've found that works in both bionic and eoan without spamming
> the build log.
>
>  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 070478e010f7..2aea5e857f79 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) \
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED[Unstable]: [PATCH][SRU][E/Unstable] UBUNTU: [Debian] Fix warnings when checking for modules signatures

Seth Forshee
In reply to this post by Seth Forshee
On Mon, Nov 25, 2019 at 08:34:51AM -0600, Seth Forshee wrote:

> 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 <[hidden email]>

Applied to unstable/master.

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team