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]
Date:   Wed, 7 Apr 2021 19:59:26 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Michal Marek <michal.lkml@...kovi.net>,
        Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
        linux-arch <linux-arch@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 02/20] kbuild: scripts/install.sh: properly quote all variables

On Wed, Apr 7, 2021 at 2:34 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> A few variables are quoted to handle spaces in directory names, but not
> all of them.  Properly quote everything so that the kernel build can
> handle working correctly with directory names with spaces.
>
> This change makes the script "shellcheck" clean now.
>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
>  scripts/install.sh | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/scripts/install.sh b/scripts/install.sh
> index d13ec1c38640..c183d6ddd00c 100644
> --- a/scripts/install.sh
> +++ b/scripts/install.sh
> @@ -33,21 +33,21 @@ verify "$3"
>
>  # User may have a custom install script
>
> -if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
> -if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
> +if [ -x ~/bin/"${INSTALLKERNEL}" ]; then exec ~/bin/"${INSTALLKERNEL}" "$@"; fi
> +if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi
>
>  # Default install - same as make zlilo
>
> -if [ -f $4/vmlinuz ]; then
> -       mv $4/vmlinuz $4/vmlinuz.old
> +if [ -f "$4"/vmlinuz ]; then
> +       mv "$4"/vmlinuz "$4"/vmlinuz.old
>  fi


Another way of quoting is doing like this:

  if [ -f "$4/vmlinuz" ]; then
       mv "$4/vmlinuz" "$4/vmlinuz.old"
  fi


shellcheck is still satisfied.





Because you will add more quotes,
quoting the whole of each parameter might be cleaner.

See my comment in 07/20.








> -if [ -f $4/System.map ]; then
> -       mv $4/System.map $4/System.old
> +if [ -f "$4"/System.map ]; then
> +       mv "$4"/System.map "$4"/System.old
>  fi
>
> -cat $2 > $4/vmlinuz
> -cp $3 $4/System.map
> +cat "$2" > "$4"/vmlinuz
> +cp "$3" "$4"/System.map
>
>  if [ -x /sbin/lilo ]; then
>         /sbin/lilo
> --
> 2.31.1
>


--
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ