]> git.baikalelectronics.ru Git - kernel.git/commit
kbuild: remove *.tmp file when filechk fails
authorMasahiro Yamada <masahiroy@kernel.org>
Fri, 10 Jan 2020 05:02:24 +0000 (14:02 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 15 Jan 2020 15:26:22 +0000 (00:26 +0900)
commit6777b4e4effc9d93cf9396f06df755500a307c6d
tree5f4cd5ce7cbb8a363ecb225c8d33b46bb61482b0
parent4786e0e712275208697206899c11f52c27219d7f
kbuild: remove *.tmp file when filechk fails

Bartosz Golaszewski reports that when "make {menu,n,g,x}config" fails
due to missing packages, a temporary file is left over, which is not
ignored by git.

For example, if GTK+ is not installed:

  $ make gconfig
  *
  * Unable to find the GTK+ installation. Please make sure that
  * the GTK+ 2.0 development package is correctly installed.
  * You need gtk+-2.0 gmodule-2.0 libglade-2.0
  *
  scripts/kconfig/Makefile:208: recipe for target 'scripts/kconfig/gconf-cfg' failed
  make[1]: *** [scripts/kconfig/gconf-cfg] Error 1
  Makefile:567: recipe for target 'gconfig' failed
  make: *** [gconfig] Error 2
  $ git status
  HEAD detached at v5.4
  Untracked files:
    (use "git add <file>..." to include in what will be committed)

          scripts/kconfig/gconf-cfg.tmp

  nothing added to commit but untracked files present (use "git add" to track)

This is because the check scripts are run with filechk, which misses
to clean up the temporary file on failure.

When the line

  { $(filechk_$(1)); } > $@.tmp;

... fails, it exits immediately due to the 'set -e'. Use trap to make
sure to delete the temporary file on exit.

For extra safety, I replaced $@.tmp with $(dot-target).tmp to make it
a hidden file.

Reported-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/Kbuild.include