diff mbox series

[Mantic/Noble/Unstable,SRU] UBUNTU: [Packaging] Fix kernel module compression failures

Message ID 20231124105138.86008-1-juerg.haefliger@canonical.com
State New
Headers show
Series [Mantic/Noble/Unstable,SRU] UBUNTU: [Packaging] Fix kernel module compression failures | expand

Commit Message

Juerg Haefliger Nov. 24, 2023, 10:51 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2044512

The kernel module compression step is run for every binary package,
not just the modules packages. This results in a build failure when
run in a console for packages that don't contain any .ko files:

\# Compress kernel modules
find debian/linux-unstable-tools-6.6.0-12 -name '*.ko' -print0 | xargs -0 -n1 -P 8 zstd -19 --quiet --rm
stdout is a console, aborting
make: *** [debian/rules.d/2-binary-arch.mk:769: binary-perarch] Error 123

Basically, if find returns nothing, zstd tries to read from stdin:
$ echo | xargs zstd
stdout is a console, aborting
$ echo $?
123

To fix that, tell xargs not to run the command if stdin is empty:
$ echo | xargs -r zstd
$ echo $?
0

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 debian/rules.d/2-binary-arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Manuel Diewald Nov. 24, 2023, 11:24 a.m. UTC | #1
On Fri, Nov 24, 2023 at 11:51:38AM +0100, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/2044512
> 
> The kernel module compression step is run for every binary package,
> not just the modules packages. This results in a build failure when
> run in a console for packages that don't contain any .ko files:
> 
> \# Compress kernel modules
> find debian/linux-unstable-tools-6.6.0-12 -name '*.ko' -print0 | xargs -0 -n1 -P 8 zstd -19 --quiet --rm
> stdout is a console, aborting
> make: *** [debian/rules.d/2-binary-arch.mk:769: binary-perarch] Error 123
> 
> Basically, if find returns nothing, zstd tries to read from stdin:
> $ echo | xargs zstd
> stdout is a console, aborting
> $ echo $?
> 123
> 
> To fix that, tell xargs not to run the command if stdin is empty:
> $ echo | xargs -r zstd
> $ echo $?
> 0
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  debian/rules.d/2-binary-arch.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 79e3e857e2c8..f1950bbdcb92 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -542,7 +542,7 @@ define dh_all
>  	dh_installdocs -p$(1)
>  	dh_compress -p$(1)
>  	# Compress kernel modules
> -	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) zstd -19 --quiet --rm
> +	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) -r zstd -19 --quiet --rm
>  	dh_fixperms -p$(1) -X/boot/
>  	dh_shlibdeps -p$(1) $(shlibdeps_opts)
>  	dh_installdeb -p$(1)
> -- 
> 2.40.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Acked-by: Manuel Diewald <manuel.diewald@canonical.com>
Thibault Ferrante Nov. 24, 2023, 12:52 p.m. UTC | #2
On 24-11-2023 11:51, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/2044512
> 
> The kernel module compression step is run for every binary package,
> not just the modules packages. This results in a build failure when
> run in a console for packages that don't contain any .ko files:
> 
> \# Compress kernel modules
> find debian/linux-unstable-tools-6.6.0-12 -name '*.ko' -print0 | xargs -0 -n1 -P 8 zstd -19 --quiet --rm
> stdout is a console, aborting
> make: *** [debian/rules.d/2-binary-arch.mk:769: binary-perarch] Error 123
> 
> Basically, if find returns nothing, zstd tries to read from stdin:
> $ echo | xargs zstd
> stdout is a console, aborting
> $ echo $?
> 123
> 
> To fix that, tell xargs not to run the command if stdin is empty:
> $ echo | xargs -r zstd
> $ echo $?
> 0
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   debian/rules.d/2-binary-arch.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 79e3e857e2c8..f1950bbdcb92 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -542,7 +542,7 @@ define dh_all
>   	dh_installdocs -p$(1)
>   	dh_compress -p$(1)
>   	# Compress kernel modules
> -	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) zstd -19 --quiet --rm
> +	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) -r zstd -19 --quiet --rm
>   	dh_fixperms -p$(1) -X/boot/
>   	dh_shlibdeps -p$(1) $(shlibdeps_opts)
>   	dh_installdeb -p$(1)

Acked-by: Thibault Ferrante <thibault.ferrante@canonical.com>

--
Thibault
Dimitri John Ledkov Nov. 24, 2023, 2:27 p.m. UTC | #3
On Fri, 24 Nov 2023 at 10:52, Juerg Haefliger
<juerg.haefliger@canonical.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/2044512
>
> The kernel module compression step is run for every binary package,
> not just the modules packages. This results in a build failure when
> run in a console for packages that don't contain any .ko files:
>
> \# Compress kernel modules
> find debian/linux-unstable-tools-6.6.0-12 -name '*.ko' -print0 | xargs -0 -n1 -P 8 zstd -19 --quiet --rm
> stdout is a console, aborting
> make: *** [debian/rules.d/2-binary-arch.mk:769: binary-perarch] Error 123
>
> Basically, if find returns nothing, zstd tries to read from stdin:
> $ echo | xargs zstd
> stdout is a console, aborting
> $ echo $?
> 123
>
> To fix that, tell xargs not to run the command if stdin is empty:
> $ echo | xargs -r zstd
> $ echo $?
> 0
>
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  debian/rules.d/2-binary-arch.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 79e3e857e2c8..f1950bbdcb92 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -542,7 +542,7 @@ define dh_all
>         dh_installdocs -p$(1)
>         dh_compress -p$(1)
>         # Compress kernel modules
> -       find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) zstd -19 --quiet --rm
> +       find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) -r zstd -19 --quiet --rm
>         dh_fixperms -p$(1) -X/boot/
>         dh_shlibdeps -p$(1) $(shlibdeps_opts)
>         dh_installdeb -p$(1)
> --
> 2.40.1
>

Today I learned.

Acked-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Agathe Porte Nov. 24, 2023, 2:35 p.m. UTC | #4
2023-11-24 11:52 CET, Juerg Haefliger:
> BugLink: https://bugs.launchpad.net/bugs/2044512
>
> The kernel module compression step is run for every binary package,
> not just the modules packages. This results in a build failure when
> run in a console for packages that don't contain any .ko files:
>
> \# Compress kernel modules
> find debian/linux-unstable-tools-6.6.0-12 -name '*.ko' -print0 | xargs -0 -n1 -P 8 zstd -19 --quiet --rm
> stdout is a console, aborting
> make: *** [debian/rules.d/2-binary-arch.mk:769: binary-perarch] Error 123
>
> Basically, if find returns nothing, zstd tries to read from stdin:
> $ echo | xargs zstd
> stdout is a console, aborting
> $ echo $?
> 123
>
> To fix that, tell xargs not to run the command if stdin is empty:
> $ echo | xargs -r zstd
> $ echo $?
> 0
>
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  debian/rules.d/2-binary-arch.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 79e3e857e2c8..f1950bbdcb92 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -542,7 +542,7 @@ define dh_all
>  	dh_installdocs -p$(1)
>  	dh_compress -p$(1)
>  	# Compress kernel modules
> -	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) zstd -19 --quiet --rm
> +	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) -r zstd -19 --quiet --rm
>  	dh_fixperms -p$(1) -X/boot/
>  	dh_shlibdeps -p$(1) $(shlibdeps_opts)
>  	dh_installdeb -p$(1)
> --
> 2.40.1
>
>
> --
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Acked-by: Agathe Porte <agathe.porte@canonical.com>

(No need to add my Ack if there are too many already — testing my email
config for patch processing)
Stefan Bader Dec. 1, 2023, 2:39 p.m. UTC | #5
On 24.11.23 11:51, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/2044512
> 
> The kernel module compression step is run for every binary package,
> not just the modules packages. This results in a build failure when
> run in a console for packages that don't contain any .ko files:
> 
> \# Compress kernel modules
> find debian/linux-unstable-tools-6.6.0-12 -name '*.ko' -print0 | xargs -0 -n1 -P 8 zstd -19 --quiet --rm
> stdout is a console, aborting
> make: *** [debian/rules.d/2-binary-arch.mk:769: binary-perarch] Error 123
> 
> Basically, if find returns nothing, zstd tries to read from stdin:
> $ echo | xargs zstd
> stdout is a console, aborting
> $ echo $?
> 123
> 
> To fix that, tell xargs not to run the command if stdin is empty:
> $ echo | xargs -r zstd
> $ echo $?
> 0
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---

The patch had to be refreshed to apply (previous patch to make module 
compression tunable). Did that and applied to mantic:linux/master-next. 
Thanks.

-Stefan

>   debian/rules.d/2-binary-arch.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 79e3e857e2c8..f1950bbdcb92 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -542,7 +542,7 @@ define dh_all
>   	dh_installdocs -p$(1)
>   	dh_compress -p$(1)
>   	# Compress kernel modules
> -	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) zstd -19 --quiet --rm
> +	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) -r zstd -19 --quiet --rm
>   	dh_fixperms -p$(1) -X/boot/
>   	dh_shlibdeps -p$(1) $(shlibdeps_opts)
>   	dh_installdeb -p$(1)
Stefan Bader Jan. 12, 2024, 10:18 a.m. UTC | #6
On 24.11.23 11:51, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/2044512
> 
> The kernel module compression step is run for every binary package,
> not just the modules packages. This results in a build failure when
> run in a console for packages that don't contain any .ko files:
> 
> \# Compress kernel modules
> find debian/linux-unstable-tools-6.6.0-12 -name '*.ko' -print0 | xargs -0 -n1 -P 8 zstd -19 --quiet --rm
> stdout is a console, aborting
> make: *** [debian/rules.d/2-binary-arch.mk:769: binary-perarch] Error 123
> 
> Basically, if find returns nothing, zstd tries to read from stdin:
> $ echo | xargs zstd
> stdout is a console, aborting
> $ echo $?
> 123
> 
> To fix that, tell xargs not to run the command if stdin is empty:
> $ echo | xargs -r zstd
> $ echo $?
> 0
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   debian/rules.d/2-binary-arch.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 79e3e857e2c8..f1950bbdcb92 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -542,7 +542,7 @@ define dh_all
>   	dh_installdocs -p$(1)
>   	dh_compress -p$(1)
>   	# Compress kernel modules
> -	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) zstd -19 --quiet --rm
> +	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) -r zstd -19 --quiet --rm
>   	dh_fixperms -p$(1) -X/boot/
>   	dh_shlibdeps -p$(1) $(shlibdeps_opts)
>   	dh_installdeb -p$(1)

This was already applied to noble:linux/master-next by Juerg back in 
November last year. Thanks.

-Stefan
diff mbox series

Patch

diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 79e3e857e2c8..f1950bbdcb92 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -542,7 +542,7 @@  define dh_all
 	dh_installdocs -p$(1)
 	dh_compress -p$(1)
 	# Compress kernel modules
-	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) zstd -19 --quiet --rm
+	find debian/$(1) -name '*.ko' -print0 | xargs -0 -n1 -P $(CONCURRENCY_LEVEL) -r zstd -19 --quiet --rm
 	dh_fixperms -p$(1) -X/boot/
 	dh_shlibdeps -p$(1) $(shlibdeps_opts)
 	dh_installdeb -p$(1)