mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/build: add 'set -e' to mkcapflags.sh to delete broken capflags.c
@ 2019-06-25  7:26 Masahiro Yamada
  2019-06-25  7:55 ` [tip:x86/build] x86/build: Add " tip-bot for Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2019-06-25  7:26 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, x86
  Cc: Masahiro Yamada, H. Peter Anvin, Borislav Petkov, linux-kernel

Without 'set -e', shell scripts continue running even after any
error occurs. The missed 'set -e' is a typical bug in shell scripting.

For example, when a disk space shortage occurs while this script is
running, it actually ends up with generating a truncated capflags.c.

Yet, mkcapflags.sh continues running and exits with 0. So, the build
system assumes it has succeeded.

It will not be re-generated in the next invocation of Make since its
timestamp is newer than that of any of the source files.

Add 'set -e' so that any error in this script is caught and propagated
to the build system.

Since 9c2af1c7377a ("kbuild: add .DELETE_ON_ERROR special target"),
Make automatically deletes the target on any failure. So, the broken
capflags.c will be deleted automatically.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/x86/kernel/cpu/mkcapflags.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/mkcapflags.sh b/arch/x86/kernel/cpu/mkcapflags.sh
index d0dfb892c72f..aed45b8895d5 100644
--- a/arch/x86/kernel/cpu/mkcapflags.sh
+++ b/arch/x86/kernel/cpu/mkcapflags.sh
@@ -4,6 +4,8 @@
 # Generate the x86_cap/bug_flags[] arrays from include/asm/cpufeatures.h
 #
 
+set -e
+
 IN=$1
 OUT=$2
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:x86/build] x86/build: Add 'set -e' to mkcapflags.sh to delete broken capflags.c
  2019-06-25  7:26 [PATCH] x86/build: add 'set -e' to mkcapflags.sh to delete broken capflags.c Masahiro Yamada
@ 2019-06-25  7:55 ` tip-bot for Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Masahiro Yamada @ 2019-06-25  7:55 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: mingo, tglx, linux-kernel, bp, hpa, yamada.masahiro

Commit-ID:  bc53d3d777f81385c1bb08b07bd1c06450ecc2c1
Gitweb:     https://git.kernel.org/tip/bc53d3d777f81385c1bb08b07bd1c06450ecc2c1
Author:     Masahiro Yamada <yamada.masahiro@socionext.com>
AuthorDate: Tue, 25 Jun 2019 16:26:22 +0900
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 25 Jun 2019 09:52:05 +0200

x86/build: Add 'set -e' to mkcapflags.sh to delete broken capflags.c

Without 'set -e', shell scripts continue running even after any
error occurs. The missed 'set -e' is a typical bug in shell scripting.

For example, when a disk space shortage occurs while this script is
running, it actually ends up with generating a truncated capflags.c.

Yet, mkcapflags.sh continues running and exits with 0. So, the build
system assumes it has succeeded.

It will not be re-generated in the next invocation of Make since its
timestamp is newer than that of any of the source files.

Add 'set -e' so that any error in this script is caught and propagated
to the build system.

Since 9c2af1c7377a ("kbuild: add .DELETE_ON_ERROR special target"),
make automatically deletes the target on any failure. So, the broken
capflags.c will be deleted automatically.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Borislav Petkov <bp@alien8.de>
Link: https://lkml.kernel.org/r/20190625072622.17679-1-yamada.masahiro@socionext.com

---
 arch/x86/kernel/cpu/mkcapflags.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/mkcapflags.sh b/arch/x86/kernel/cpu/mkcapflags.sh
index d0dfb892c72f..aed45b8895d5 100644
--- a/arch/x86/kernel/cpu/mkcapflags.sh
+++ b/arch/x86/kernel/cpu/mkcapflags.sh
@@ -4,6 +4,8 @@
 # Generate the x86_cap/bug_flags[] arrays from include/asm/cpufeatures.h
 #
 
+set -e
+
 IN=$1
 OUT=$2
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-25  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25  7:26 [PATCH] x86/build: add 'set -e' to mkcapflags.sh to delete broken capflags.c Masahiro Yamada
2019-06-25  7:55 ` [tip:x86/build] x86/build: Add " tip-bot for Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome