[D][E][SRU][PATCH 2/2] selftests/ftrace: Replace echo -e with printf
Po-Hsu Lin
po-hsu.lin at canonical.com
Tue May 14 10:56:54 UTC 2019
From: Juerg Haefliger <juerg.haefliger at canonical.com>
BugLink: https://bugs.launchpad.net/bugs/1828995
echo -e is not POSIX. Depending on what /bin/sh is, we can get
incorrect output like:
$ -e -n [1] Basic trace file check
$ -e [PASS]
Fix that by using printf instead.
Acked-by: Steven Rostedt (VMware) <rostedt at goodmis.org>
Acked-by: Masami Hiramatsu <mhiramat at kernel.org>
Signed-off-by: Juerg Haefliger <juergh at canonical.com>
Signed-off-by: Shuah Khan <shuah at kernel.org>
(cherry picked from commit 37fb665b059edcd6ab87b1541402eef3dac91168)
Signed-off-by: Po-Hsu Lin <po-hsu.lin at canonical.com>
---
tools/testing/selftests/ftrace/ftracetest | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index 384972b..316f2bf 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -173,8 +173,13 @@ strip_esc() {
}
prlog() { # messages
- echo -e "$@"
- [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE
+ newline="\n"
+ if [ "$1" = "-n" ] ; then
+ newline=
+ shift
+ fi
+ printf "$*$newline"
+ [ "$LOG_FILE" ] && printf "$*$newline" | strip_esc >> $LOG_FILE
}
catlog() { #file
cat $1
--
2.7.4
More information about the kernel-team
mailing list