[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNASRgcmSBTMj=wq3uo441hRceEJ19ga_mFDf5DCEPvh8LQ@mail.gmail.com>
Date: Wed, 3 Jul 2024 02:31:33 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Nicolas Schier <n.schier@....de>
Cc: Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kbuild: deb-dpkg: Check optional env variables before use
On Tue, Jun 25, 2024 at 9:46 PM Nicolas Schier <n.schier@....de> wrote:
>
> Add checks to mkdebian for undefined optional environment variables
> before evaluating them.
>
> Some variables used by scripts/package/mkdebian are fully optional and
> not set by kbuild. In order to allow enabling 'set -u' (shell script
> exits on dereference of undefined variables), introduce the explicit
> checking.
This patch is not enough for enabling -u.
email=${DEBEMAIL-$EMAIL}
causes an error.
$ unset DEBEMAIL; unset EMAIL; make deb-pkg
GEN debian
./scripts/package/mkdebian: 128: EMAIL: parameter not set
I can do this work myself.
>
> Suggested-by: Masahiro Yamada <masahiroy@...nel.org>
> Signed-off-by: Nicolas Schier <n.schier@....de>
> ---
> This allows application of the original patch
> [PATCH 1/2] kconfig: add -e and -u options to *conf-cfg.sh scripts
> [PATCH 2/2] kbuild: package: add -e and -u options to shell scripts
> as sent https://lore.kernel.org/linux-kbuild/20240611160938.3511096-1-masahiroy@kernel.org/
> ---
> scripts/package/mkdebian | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index b9a5b789c655..2a7bb05c7f60 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -19,7 +19,7 @@ if_enabled_echo() {
> }
>
> set_debarch() {
> - if [ -n "$KBUILD_DEBARCH" ] ; then
> + if [ "${KBUILD_DEBARCH:+set}" ] ; then
> debarch="$KBUILD_DEBARCH"
> return
> fi
> @@ -147,7 +147,7 @@ fi
>
> # Some variables and settings used throughout the script
> version=$KERNELRELEASE
> -if [ -n "$KDEB_PKGVERSION" ]; then
> +if [ "${KDEB_PKGVERSION:+set}" ]; then
> packageversion=$KDEB_PKGVERSION
> else
> packageversion=$(${srctree}/scripts/setlocalversion --no-local ${srctree})-$($srctree/scripts/build-version)
> @@ -164,7 +164,7 @@ debarch=
> set_debarch
>
> # Try to determine distribution
> -if [ -n "$KDEB_CHANGELOG_DIST" ]; then
> +if [ "${KDEB_CHANGELOG_DIST:+set}" ]; then
> distribution=$KDEB_CHANGELOG_DIST
> # In some cases lsb_release returns the codename as n/a, which breaks dpkg-parsechangelog
> elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then
>
> ---
> base-commit: 3893a22a160edd1c15b483deb3dee36b36ee4226
> change-id: 20240625-mkdebian-check-if-optional-vars-are-defined-a46cf0524e4e
>
> Best regards,
> --
> Nicolas Schier
>
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists