Skip to contentSkip to conversation

perf llvm-utils: remove bashism from kernel include fetch script

PATCH Applied Kim Phillips 2 participants 2 messages Jun 29, 2018 – Jul 12, 2018 perf events

lore
Share & tools
lore
#0 lore raw

PATCH v2 3/4 perf llvm-utils: remove bashism from kernel include fetch script

Like system(), popen() calls /bin/sh, which may/may not be bash.

Script when run on dash and encounters the line, yields:

exit: Illegal number: -1

checkbashisms report on script content:

possible bashism (exit|return with negative status code):
exit -1

Remove the bashism and use the more portable non-zero failure status code 1.

---
v2: new for this remove bashisms series

 tools/perf/util/llvm-utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/llvm-utils.c +3 -3
index 976e658e38dc..5e94857dfca2 100644
@@ -266,16 +266,16 @@ static const char *kinc_fetch_script =
 "#!/usr/bin/env sh\n"
 "if ! test -d \"$KBUILD_DIR\"\n"
 "then\n"
-"	exit -1\n"
+"	exit 1\n"
 "fi\n"
 "if ! test -f \"$KBUILD_DIR/include/generated/autoconf.h\"\n"
 "then\n"
-"	exit -1\n"
+"	exit 1\n"
 "fi\n"
 "TMPDIR=`mktemp -d`\n"
 "if test -z \"$TMPDIR\"\n"
 "then\n"
-"    exit -1\n"
+"    exit 1\n"
 "fi\n"
 "cat << EOF > $TMPDIR/Makefile\n"
 "obj-y := dummy.o\n"
Signature · 1 line
2.17.1
#1 lore raw

[tip:perf/urgent] perf llvm-utils: Remove bashism from kernel include fetch script

perf llvm-utils: Remove bashism from kernel include fetch script
Commit-ID:  f6432b9f65001651412dbc3589d251534822d4ab
Gitweb:     https://git.kernel.org/tip/f6432b9f65001651412dbc3589d251534822d4ab
Author:     Kim Phillips <[email protected]>
AuthorDate: Fri, 29 Jun 2018 12:46:52 -0500
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 11 Jul 2018 10:01:51 -0300

perf llvm-utils: Remove bashism from kernel include fetch script

Like system(), popen() calls /bin/sh, which may/may not be bash.

Script when run on dash and encounters the line, yields:

exit: Illegal number: -1

checkbashisms report on script content:

possible bashism (exit|return with negative status code):
exit -1

Remove the bashism and use the more portable non-zero failure status code 1.

Cc Alexander Shishkin <[email protected]>
Cc Hendrik Brueckner <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Michael Petlan <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Sandipan Das <[email protected]>
Cc Thomas Richter <[email protected]>
---
 tools/perf/util/llvm-utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/llvm-utils.c +3 -3
index 976e658e38dc..5e94857dfca2 100644
@@ -266,16 +266,16 @@ static const char *kinc_fetch_script =
 "#!/usr/bin/env sh\n"
 "if ! test -d \"$KBUILD_DIR\"\n"
 "then\n"
-"	exit -1\n"
+"	exit 1\n"
 "fi\n"
 "if ! test -f \"$KBUILD_DIR/include/generated/autoconf.h\"\n"
 "then\n"
-"	exit -1\n"
+"	exit 1\n"
 "fi\n"
 "TMPDIR=`mktemp -d`\n"
 "if test -z \"$TMPDIR\"\n"
 "then\n"
-"    exit -1\n"
+"    exit 1\n"
 "fi\n"
 "cat << EOF > $TMPDIR/Makefile\n"
 "obj-y := dummy.o\n"