]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerMasahiro Yamada <masahiroy@kernel.org>
Fri, 3 Jan 2020 15:00:48 +0000 (00:00 +0900)
commit1dcf27bc05979dee4949cebc6a25987cee3bb56f
tree05915b067d504e3224d006a486e14319c84a07a2
parent646cf7ee5f9780d038ddeb0aba0fbb1435cffff2
gen_initramfs_list.sh: fix 'bad variable name' error

Prior to commit b9aa048f20f6 ("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: b9aa048f20f6 ("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>
usr/gen_initramfs_list.sh