All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juerg Haefliger <juerg.haefliger@canonical.com>
To: linux-kernel@vger.kernel.org, rostedt@goodmis.org,
	mingo@redhat.com, mhiramat@kernel.org, shuah@kernel.org,
	linux-kselftest@vger.kernel.org
Cc: Juerg Haefliger <juergh@canonical.com>
Subject: [RESEND PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf
Date: Fri, 22 Feb 2019 21:53:50 +0100	[thread overview]
Message-ID: <20190222205351.743-2-juergh@canonical.com> (raw)
In-Reply-To: <20190222205351.743-1-juergh@canonical.com>

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@goodmis.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Juerg Haefliger <juergh@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 fc755e1b50f1..20c9c0ad8682 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.19.1


WARNING: multiple messages have this Message-ID (diff)
From: juerg.haefliger at canonical.com (Juerg Haefliger)
Subject: [RESEND PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf
Date: Fri, 22 Feb 2019 21:53:50 +0100	[thread overview]
Message-ID: <20190222205351.743-2-juergh@canonical.com> (raw)
In-Reply-To: <20190222205351.743-1-juergh@canonical.com>

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>
---
 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 fc755e1b50f1..20c9c0ad8682 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.19.1

WARNING: multiple messages have this Message-ID (diff)
From: juerg.haefliger@canonical.com (Juerg Haefliger)
Subject: [RESEND PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf
Date: Fri, 22 Feb 2019 21:53:50 +0100	[thread overview]
Message-ID: <20190222205351.743-2-juergh@canonical.com> (raw)
Message-ID: <20190222205350.tBk--_dtN8qOnPrzvE6Syclmlx_1JdyGJFSQt4JkmEQ@z> (raw)
In-Reply-To: <20190222205351.743-1-juergh@canonical.com>

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>
---
 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 fc755e1b50f1..20c9c0ad8682 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.19.1

  reply	other threads:[~2019-02-22 20:54 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20 16:13 [PATCH] selftests/ftrace: Make the coloring POSIX compliant Juerg Haefliger
2019-02-20 19:49 ` Steven Rostedt
2019-02-20 20:20   ` Juerg Haefliger
2019-02-20 20:33     ` Adam Borowski
2019-02-22  0:29 ` Masami Hiramatsu
2019-02-22  9:10 ` [PATCH v2 0/2] selftests/ftrace: Make ftracetest " Juerg Haefliger
2019-02-22  9:10   ` [PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf Juerg Haefliger
2019-02-22 14:58     ` Masami Hiramatsu
2019-02-22 15:58       ` shuah
2019-02-22  9:10   ` [PATCH v2 2/2] selftests/ftrace: Replace \e with \033 Juerg Haefliger
2019-02-22 14:59     ` Masami Hiramatsu
2019-02-22 15:59       ` shuah
2019-02-22 19:03         ` Steven Rostedt
2019-02-22 20:52   ` [RESEND PATCH v2 0/2] selftests/ftrace: Make ftracetest POSIX compliant Juerg Haefliger
2019-02-22 20:52     ` Juerg Haefliger
2019-02-22 20:52     ` juerg.haefliger
2019-02-22 20:52     ` [RESEND PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf Juerg Haefliger
2019-02-22 20:52       ` Juerg Haefliger
2019-02-22 20:52       ` juerg.haefliger
2019-02-22 20:53   ` [RESEND PATCH v2 0/2] selftests/ftrace: Make ftracetest POSIX compliant Juerg Haefliger
2019-02-22 20:53     ` Juerg Haefliger
2019-02-22 20:53     ` juerg.haefliger
2019-02-22 20:53     ` [RESEND PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf Juerg Haefliger
2019-02-22 20:53       ` Juerg Haefliger
2019-02-22 20:53       ` juerg.haefliger
2019-02-22 20:53   ` [RESEND PATCH v2 0/2] selftests/ftrace: Make ftracetest POSIX compliant Juerg Haefliger
2019-02-22 20:53     ` Juerg Haefliger
2019-02-22 20:53     ` juerg.haefliger
2019-02-22 20:53     ` Juerg Haefliger [this message]
2019-02-22 20:53       ` [RESEND PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf Juerg Haefliger
2019-02-22 20:53       ` juerg.haefliger
2019-02-22 22:33       ` shuah
2019-02-22 22:33         ` shuah
2019-02-22 22:33         ` shuah
2019-02-22 20:53     ` [RESEND PATCH v2 2/2] selftests/ftrace: Replace \e with \033 Juerg Haefliger
2019-02-22 20:53       ` Juerg Haefliger
2019-02-22 20:53       ` juerg.haefliger
2019-02-22 22:46       ` shuah
2019-02-22 22:46         ` shuah
2019-02-22 22:46         ` shuah
2019-02-23 12:25         ` Juerg Haefliger
2019-02-23 12:25           ` Juerg Haefliger
2019-02-23 12:25           ` juerg.haefliger
2019-02-25 13:00           ` shuah
2019-02-25 13:00             ` shuah
2019-02-25 13:00             ` shuah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190222205351.743-2-juergh@canonical.com \
    --to=juerg.haefliger@canonical.com \
    --cc=juergh@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.