linux-stable/scripts
Masahiro Yamada 23d3f191a5 kbuild: remove *.tmp file when filechk fails
[ Upstream commit 88fe89a471 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:49 +01:00
..
atomic
basic kbuild: remove unneeded comments and code from scripts/basic/Makefile 2019-08-29 23:54:29 +09:00
coccinelle coccinelle: api/devm_platform_ioremap_resource: remove useless script 2019-10-17 09:05:56 -07:00
dtc dtc: Use pkg-config to locate libyaml 2020-01-04 19:17:09 +01:00
gcc-plugins gcc-plugins: make it possible to disable CONFIG_GCC_PLUGINS again 2020-01-09 10:19:57 +01:00
gdb scripts/gdb: fix debugging modules compiled with hot/cold partitioning 2019-11-06 08:47:50 -08:00
genksyms genksyms: convert to SPDX License Identifier for lex.l and parse.y 2019-09-14 11:40:13 +09:00
kconfig kconfig: fix broken dependency in randconfig-generated .config 2020-02-24 08:36:32 +01:00
ksymoops
mod symbol namespaces: revert to previous __ksymtab name scheme 2019-10-18 15:32:52 +02:00
package kbuild/deb-pkg: annotate libelf-dev dependency as :native 2020-01-17 19:49:07 +01:00
selinux
tracing
.gitignore
adjust_autoksyms.sh
asn1_compiler.c
bin2c.c
bloat-o-meter
bootgraph.pl
bpf_helpers_doc.py
cc-can-link.sh
check_extable.sh
checkincludes.pl
checkkconfigsymbols.py
checkpatch.pl checkpatch: check for nested (un)?likely() calls 2019-09-25 17:51:42 -07:00
checkstack.pl
checksyscalls.sh
checkversion.pl
clang-version.sh
cleanfile
cleanpatch
coccicheck
config
conmakehash.c
const_structs.checkpatch
decode_stacktrace.sh
decodecode
depmod.sh
diffconfig
documentation-file-ref-check
export_report.pl modpost: add support for symbol namespaces 2019-09-10 10:30:21 +02:00
extract-cert.c
extract-ikconfig
extract-module-sig.pl
extract-sys-certs.pl
extract-vmlinux
extract_xc3028.pl
faddr2line
file-size.sh
find-unused-docs.sh scripts/find-unused-docs: Fix massive false positives 2020-02-11 04:35:23 -08:00
gcc-goto.sh
gcc-ld
gcc-plugin.sh
gcc-version.sh
gcc-x86_32-has-stack-protector.sh
gcc-x86_64-has-stack-protector.sh
gen_compile_commands.py gen_compile_commands: lower the entry count threshold 2019-07-27 12:18:19 +09:00
gen_ksymdeps.sh
get_abi.pl
get_dvb_firmware
get_maintainer.pl
gfp-translate
headerdep.pl
headers_check.pl
headers_install.sh kbuild: re-implement detection of CONFIG options leaked to user-space 2019-08-21 21:05:21 +09:00
insert-sys-cert.c
kallsyms.c scripts/kallsyms: fix definitely-lost memory leak 2020-01-04 19:18:23 +01:00
Kbuild.include kbuild: remove *.tmp file when filechk fails 2020-02-24 08:36:49 +01:00
Kconfig.include kbuild: Fail if gold linker is detected 2019-08-14 01:10:42 +09:00
kernel-doc kernel-doc: Allow anonymous enum 2019-08-12 15:00:37 -06:00
ld-version.sh
leaking_addresses.pl
Lindent
link-vmlinux.sh bpf: Force .BTF section start to zero when dumping from vmlinux 2020-01-26 10:00:58 +01:00
Makefile Merge branch 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity 2019-09-27 19:37:27 -07:00
Makefile.asm-generic
Makefile.build kbuild: remove ar-option and KBUILD_ARFLAGS 2019-10-01 09:20:33 +09:00
Makefile.clean kbuild: clean up subdir-ymn calculation in Makefile.clean 2019-08-29 23:54:29 +09:00
Makefile.dtbinst
Makefile.extrawarn kbuild: allow Clang to find unused static inline functions for W=1 build 2019-09-09 23:55:43 +09:00
Makefile.gcc-plugins
Makefile.headersinst
Makefile.host kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) 2019-09-04 23:12:50 +09:00
Makefile.kasan kasan/arm64: fix CONFIG_KASAN_SW_TAGS && KASAN_INLINE 2019-08-15 13:24:04 +01:00
Makefile.kcov
Makefile.lib kbuild: remove ar-option and KBUILD_ARFLAGS 2019-10-01 09:20:33 +09:00
Makefile.modbuiltin
Makefile.modfinal kbuild: move modkern_{c,a}flags to Makefile.lib from Makefile.build 2019-08-22 01:14:11 +09:00
Makefile.modinst
Makefile.modpost Modules updates for v5.4 2019-09-22 10:34:46 -07:00
Makefile.modsign
Makefile.package kbuild: pkg: rename scripts/package/Makefile to scripts/Makefile.package 2019-08-25 07:42:00 +09:00
Makefile.ubsan
makelst
markup_oops.pl
mkcompile_h Kbuild: Handle PREEMPT_RT for version string and magic 2019-08-14 01:10:42 +09:00
mkmakefile kbuild: get rid of $(realpath ...) from scripts/mkmakefile 2019-08-29 23:54:29 +09:00
mksysmap
mkuboot.sh
module-common.lds
modules-check.sh
namespace.pl namespace: fix namespace.pl script to support relative paths 2019-10-05 15:29:49 +09:00
nsdeps scripts/nsdeps: make sure to pass all module source files to spatch 2019-11-05 14:08:29 +01:00
objdiff
parse-maintainers.pl
patch-kernel
pnmtologo.c
profile2linkerlist.pl
prune-kernel
recordmcount.c ARM: 8950/1: ftrace/recordmcount: filter relocation types 2020-01-29 16:45:27 +01:00
recordmcount.h recordmcount: Fix nop_mcount() function 2019-10-12 20:49:33 -04:00
recordmcount.pl
setlocalversion scripts: setlocalversion: fix a bashism 2019-10-15 23:45:07 +09:00
show_delta
sign-file.c
sortextable.c
sortextable.h
spdxcheck-test.sh
spdxcheck.py
spelling.txt
sphinx-pre-install
split-man.pl
stackdelta
stackusage
subarch.include
tags.sh
tools-support-relr.sh scripts/tools-support-relr.sh: un-quote variables 2019-11-13 10:52:05 +00:00
unifdef.c
ver_linux
xen-hypercalls.sh
xz_wrap.sh