[PATCH] kbuild: deb-pkg: Fix build error caused by lack of positionnal argument

Marc Zyngier posted 1 patch 1 year, 5 months ago
scripts/package/mkdebian | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] kbuild: deb-pkg: Fix build error caused by lack of positionnal argument
Posted by Marc Zyngier 1 year, 5 months ago
Since 8ef052389f7f ("kbuild: package: add -e and -u options to some
shell scripts"), building a debian package on my arm64 box fails:

$ make -j20 bindeb-pkg
  UPD     include/config/kernel.release
  GEN     debian
./scripts/package/mkdebian: 138: 1: parameter not set
make[2]: *** [scripts/Makefile.package:98: debian] Error 2
make[1]: *** [/home/maz/hot-poop/arm-platforms/Makefile:1538: bindeb-pkg] Error 2
make: *** [Makefile:224: __sub-make] Error 2

Applying the same pattern for substitution of undefined variables
seems to paper over the issue and brings the script back to life.

Fixes: 8ef052389f7f ("kbuild: package: add -e and -u options to some shell scripts")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nicolas Schier <nicolas@fjasle.eu>
---
 scripts/package/mkdebian | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 196b14e8ad47..de8b460a46b4 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -135,7 +135,7 @@ else
 fi
 maintainer="${name} <${email}>"
 
-if [ "$1" = --need-source ]; then
+if [ "${1:+set}" = --need-source ]; then
 	gen_source
 fi
 
-- 
2.39.2
Re: [PATCH] kbuild: deb-pkg: Fix build error caused by lack of positionnal argument
Posted by Masahiro Yamada 1 year, 5 months ago
On Thu, Jul 11, 2024 at 2:27 AM Marc Zyngier <maz@kernel.org> wrote:
>
> Since 8ef052389f7f ("kbuild: package: add -e and -u options to some
> shell scripts"), building a debian package on my arm64 box fails:
>
> $ make -j20 bindeb-pkg
>   UPD     include/config/kernel.release
>   GEN     debian
> ./scripts/package/mkdebian: 138: 1: parameter not set
> make[2]: *** [scripts/Makefile.package:98: debian] Error 2
> make[1]: *** [/home/maz/hot-poop/arm-platforms/Makefile:1538: bindeb-pkg] Error 2
> make: *** [Makefile:224: __sub-make] Error 2
>
> Applying the same pattern for substitution of undefined variables
> seems to paper over the issue and brings the script back to life.
>
> Fixes: 8ef052389f7f ("kbuild: package: add -e and -u options to some shell scripts")
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Nicolas Schier <nicolas@fjasle.eu>
> ---
>  scripts/package/mkdebian | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index 196b14e8ad47..de8b460a46b4 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -135,7 +135,7 @@ else
>  fi
>  maintainer="${name} <${email}>"
>
> -if [ "$1" = --need-source ]; then
> +if [ "${1:+set}" = --need-source ]; then
>         gen_source
>  fi
>


This is wrong.

It will break 'make srcdeb-pkg' because
"set" = "--need-source" is always false.



I will squash the following.


while [ $# -gt 0 ]; do
    case "$1" in
    --need-source)
        gen_source
        shift
        ;;
    *)
        break
        ;;
    esac
done


Thanks for the report.
















-- 
Best Regards
Masahiro Yamada
Re: [PATCH] kbuild: deb-pkg: Fix build error caused by lack of positionnal argument
Posted by Marc Zyngier 1 year, 5 months ago
On Tue, 16 Jul 2024 08:06:06 +0100,
Masahiro Yamada <masahiroy@kernel.org> wrote:
> 
> On Thu, Jul 11, 2024 at 2:27 AM Marc Zyngier <maz@kernel.org> wrote:
> >
> > Since 8ef052389f7f ("kbuild: package: add -e and -u options to some
> > shell scripts"), building a debian package on my arm64 box fails:
> >
> > $ make -j20 bindeb-pkg
> >   UPD     include/config/kernel.release
> >   GEN     debian
> > ./scripts/package/mkdebian: 138: 1: parameter not set
> > make[2]: *** [scripts/Makefile.package:98: debian] Error 2
> > make[1]: *** [/home/maz/hot-poop/arm-platforms/Makefile:1538: bindeb-pkg] Error 2
> > make: *** [Makefile:224: __sub-make] Error 2
> >
> > Applying the same pattern for substitution of undefined variables
> > seems to paper over the issue and brings the script back to life.
> >
> > Fixes: 8ef052389f7f ("kbuild: package: add -e and -u options to some shell scripts")
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > Cc: Masahiro Yamada <masahiroy@kernel.org>
> > Cc: Nicolas Schier <nicolas@fjasle.eu>
> > ---
> >  scripts/package/mkdebian | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> > index 196b14e8ad47..de8b460a46b4 100755
> > --- a/scripts/package/mkdebian
> > +++ b/scripts/package/mkdebian
> > @@ -135,7 +135,7 @@ else
> >  fi
> >  maintainer="${name} <${email}>"
> >
> > -if [ "$1" = --need-source ]; then
> > +if [ "${1:+set}" = --need-source ]; then
> >         gen_source
> >  fi
> >
> 
> 
> This is wrong.
> 
> It will break 'make srcdeb-pkg' because
> "set" = "--need-source" is always false.
> 
> 
> 
> I will squash the following.
> 
> 
> while [ $# -gt 0 ]; do
>     case "$1" in
>     --need-source)
>         gen_source
>         shift
>         ;;
>     *)
>         break
>         ;;
>     esac
> done
> 
> 
> Thanks for the report.

This seems to work for me.

	M.

-- 
Without deviation from the norm, progress is not possible.