lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240625170048.GA3877857@thelio-3990X>
Date: Tue, 25 Jun 2024 10:00:48 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Nicolas Schier <n.schier@....de>
Cc: Masahiro Yamada <masahiroy@...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 02:45:56PM +0200, Nicolas Schier 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.
> 
> Suggested-by: Masahiro Yamada <masahiroy@...nel.org>
> Signed-off-by: Nicolas Schier <n.schier@....de>

Looks good to me.

Reviewed-by: Nathan Chancellor <nathan@...nel.org>

> ---
> 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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ