gen_initramfs_list.sh: fix 'bad variable name' error
authorMasahiro Yamada <masahiroy@kernel.org>
Mon, 30 Dec 2019 13:20:06 +0000 (22:20 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2020 09:20:00 +0000 (10:20 +0100)
commitebf3afa3cbd1778131af012531a0f7cc896c6621
treed1f5857a3b0049426cde6232bd58607d898a524a
parentfdfd8f9ef2d3a35764e8fabc035bd0bbb382e318
gen_initramfs_list.sh: fix 'bad variable name' error

commit cc976614f59bd8e45de8ce988a6bcb5de711d994 upstream.

Prior to commit 858805b336be ("kbuild: add $(BASH) to run scripts with
bash-extension"), this shell script was almost always run by bash since
bash is usually installed on the system by default.

Now, this script is run by sh, which might be a symlink to dash. On such
distributions, the following code emits an error:

  local dev=`LC_ALL=C ls -l "${location}"`

You can reproduce the build error, for example by setting
CONFIG_INITRAMFS_SOURCE="/dev".

    GEN     usr/initramfs_data.cpio.gz
  ./usr/gen_initramfs_list.sh: 131: local: 1: bad variable name
  make[1]: *** [usr/Makefile:61: usr/initramfs_data.cpio.gz] Error 2

This is because `LC_ALL=C ls -l "${location}"` contains spaces.
Surrounding it with double-quotes fixes the error.

Fixes: 858805b336be ("kbuild: add $(BASH) to run scripts with bash-extension")
Reported-by: Jory A. Pratt <anarchy@gentoo.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
usr/gen_initramfs_list.sh