Skip to contentSkip to conversation

selftests/ftrace: Make the coloring POSIX compliant

PATCH Superseded Juerg Haefliger 5 participants 24 messages Feb 20, 2019 – Feb 25, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/ftrace: Make the coloring POSIX compliant

echo -e and \e are 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 \033 instead of \e and printf.

---
 tools/testing/selftests/ftrace/ftracetest | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
tools/testing/selftests/ftrace/ftracetest +11 -6
index fc755e1b50f1..f200898e3e2c 100755
@@ -161,10 +161,10 @@ color_green=
 color_blue=
 # If stdout exists and number of colors is eight or more, use them
 if [ -t 1 -a "$ncolors" -ge 8 ]; then
-  color_reset="\e[0m"
-  color_red="\e[31m"
-  color_green="\e[32m"
-  color_blue="\e[34m"
+  color_reset="\033[0m"
+  color_red="\033[31m"
+  color_green="\033[32m"
+  color_blue="\033[34m"
 fi
 
 strip_esc() {
@@ -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
Signature · 1 line
2.19.1
maintainer
#1 lore raw
Quoted 2 lines · On Wed, 20 Feb 2019 17:13:33 +0100 Juerg Haefliger…

echo -e and \e are not POSIX. Depending on what /bin/sh is, we can get incorrect output like:

I'm curious to which shell this is.

Quoted 35 lines
$ -e -n [1] Basic trace file check
$ -e 	[PASS]

Fix that by using \033 instead of \e and printf.

---
 tools/testing/selftests/ftrace/ftracetest | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
tools/testing/selftests/ftrace/ftracetest +4 -6
index fc755e1b50f1..f200898e3e2c 100755
@@ -161,10 +161,10 @@ color_green=
 color_blue=
 # If stdout exists and number of colors is eight or more, use them
 if [ -t 1 -a "$ncolors" -ge 8 ]; then
-  color_reset="\e[0m"
-  color_red="\e[31m"
-  color_green="\e[32m"
-  color_blue="\e[34m"
+  color_reset="\033[0m"
+  color_red="\033[31m"
+  color_green="\033[32m"
+  color_blue="\033[34m"
 fi
 
 strip_esc() {
@@ -173,8 +173,13 @@ strip_esc() {
 }
 
 prlog() { # messages
-  echo -e "$@"
-  [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE

tools/testing/selftests/ftrace/ftracetest strip_esc() { · line 185

Quoted 10 lines
tools/testing/selftests/ftrace/ftracetest +7 -0
+  newline="\n"
+  if [ "$1" = "-n" ] ; then
+    newline=
+    shift
+  fi
+  printf "$@$newline"
+  [ "$LOG_FILE" ] && printf "$@$newline" | strip_esc >> $LOG_FILE
 }
 catlog() { #file
   cat $1

This should probably be split into two patches, as they are two different issues.

-- Steve

#2 lore raw
Quoted 7 lines · On Wed, 20 Feb 2019 14:49:34 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 2 lines · On Wed, 20 Feb 2019 17:13:33 +0100 Juerg Haefliger…

echo -e and \e are not POSIX. Depending on what /bin/sh is, we can get incorrect output like:

I'm curious to which shell this is.

Quite frankly I don't know but that's the output we get when we run it in Jenkins. I'll try to find out.

Quoted 32 lines
Quoted 32 lines
$ -e -n [1] Basic trace file check
$ -e 	[PASS]

Fix that by using \033 instead of \e and printf.

---
 tools/testing/selftests/ftrace/ftracetest | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
tools/testing/selftests/ftrace/ftracetest +4 -4
index fc755e1b50f1..f200898e3e2c 100755
@@ -161,10 +161,10 @@ color_green=
 color_blue=
 # If stdout exists and number of colors is eight or more, use them
 if [ -t 1 -a "$ncolors" -ge 8 ]; then
-  color_reset="\e[0m"
-  color_red="\e[31m"
-  color_green="\e[32m"
-  color_blue="\e[34m"
+  color_reset="\033[0m"
+  color_red="\033[31m"
+  color_green="\033[32m"
+  color_blue="\033[34m"
 fi
 
 strip_esc() {
@@ -173,8 +173,13 @@ strip_esc() {
 }
 
Quoted 16 lines

tools/testing/selftests/ftrace/ftracetest strip_esc() { · line 185

Quoted 13 lines
tools/testing/selftests/ftrace/ftracetest +7 -2
 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  

This should probably be split into two patches, as they are two different issues.

Will do.

...Juerg

Quoted 1 line

-- Steve

#3 lore raw
Quoted 6 lines · Juerg Haefliger
Quoted 3 lines · On Wed, 20 Feb 2019 14:49:34 -0500 Steven Rostedt <[email protected]> wrote:

On Wed, 20 Feb 2019 17:13:33 +0100
Juerg Haefliger <[email protected]> wrote:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

echo -e and \e are not POSIX. Depending on what /bin/sh is, we can get incorrect output like:

I'm curious to which shell this is.

Quite frankly I don't know but that's the output we get when we run it in Jenkins. I'll try to find out.

The only shell that did not support \e was dash -- I fixed it myself on 2017-01-24; thus I expect any Ubuntus prior to Zesty to require \033. This means your Jenkins likely runs Xenial.

\e has been supported since ages in at least: bash zsh mksh sash posh ksh busybox:sh; also in perl python ruby lua php, gcc clang tcc -- MSVC being the only other exception I know about.

Indeed POSIX doesn't specify \e, but as it pretends there are charsets other than ASCII and EBCDIC, it can't. There's no escape in its "portable character set".

Meow!

Signature · 4 lines
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁
⢿⡄⠘⠷⠚⠋⠀ Have you accepted Khorne as your lord and saviour?
⠈⠳⣄⠀⠀⠀⠀
maintainer
#4 lore raw
In reply to Juerg Haefliger

Hi Juerg,

Quoted 6 lines · On Wed, 20 Feb 2019 17:13:33 +0100 Juerg Haefliger…

echo -e and \e are 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 \033 instead of \e and printf.

OK, as far as I can check with checkbashisms, echo -e is not acceptable.

$ checkbashisms ./ftracetest 
possible bashism in ./ftracetest line 176 (echo -e):
  echo -e "$@"
possible bashism in ./ftracetest line 177 (echo -e):
  [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE

So it should be fixed, even other shells support it. (Or, update checkbashisms command...)

However,

tools/testing/selftests/ftrace/ftracetest strip_esc() { · line 182

Quoted 10 lines

prlog() { # messages

tools/testing/selftests/ftrace/ftracetest +7 -2
-  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

This doesn't work when prlog gets several arguments. (like the summary line) for example I got below result.

# of passed: # of failed: # of unresolved: # of untested: # of unsupported: # of xfailed: # of undefined(test bug): 

Replacing $@ with $* shows correct result. Could you fix it?

Thank you,

Signature · 1 line
Masami Hiramatsu <[email protected]>
#5 lore raw

v2 cover selftests/ftrace: Make ftracetest POSIX compliant

In reply to Juerg Haefliger

The recent addition of colored output introduced some non-POSIX-compliant constructs. Fix that.

Juerg Haefliger (2):
selftests/ftrace: Replace echo -e with printf
selftests/ftrace: Replace \e with \033

 tools/testing/selftests/ftrace/ftracetest | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Signature · 1 line
2.19.1
#6 lore raw

PATCH v2 1/2 selftests/ftrace: Replace echo -e with printf

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.

---
 tools/testing/selftests/ftrace/ftracetest | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/ftracetest +7 -2
index fc755e1b50f1..20c9c0ad8682 100755
@@ -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
Signature · 1 line
2.19.1
maintainer Acked-by on v2 1/2
#7 lore raw

Re: [PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf

Quoted 8 lines · On Fri, 22 Feb 2019 10:10:20 +0100 Juerg Haefliger…

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.

Looks good to me.

Thanks!

Quoted 27 lines
---
 tools/testing/selftests/ftrace/ftracetest | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/ftracetest +7 -2
index fc755e1b50f1..20c9c0ad8682 100755
@@ -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
Signature · 1 line
2.19.1
Signature · 1 line
Masami Hiramatsu <[email protected]>
maintainer
#8 lore raw

Re: [PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf

Hi Juerg,

Quoted 8 lines · Masami Hiramatsu
Quoted 5 lines · On Fri, 22 Feb 2019 10:10:20 +0100 Juerg Haefliger…

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]
Quoted 8 lines
Quoted 3 lines

Fix that by using printf instead.

Looks good to me.

I wasn't on the To or Cc on the original patch. Make sure to run the get_maintainers and include the people it recommends.

Please resend the patch to me, so I can take it for 5.1-rc1

thanks,
-- Shuah

#9 lore raw

PATCH v2 2/2 selftests/ftrace: Replace \e with \033

In reply to Juerg Haefliger

The \e sequence character is not POSIX. Fix that by using \033 instead.

---
 tools/testing/selftests/ftrace/ftracetest | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/ftracetest +4 -4
index 20c9c0ad8682..136387422b00 100755
@@ -161,10 +161,10 @@ color_green=
 color_blue=
 # If stdout exists and number of colors is eight or more, use them
 if [ -t 1 -a "$ncolors" -ge 8 ]; then
-  color_reset="\e[0m"
-  color_red="\e[31m"
-  color_green="\e[32m"
-  color_blue="\e[34m"
+  color_reset="\033[0m"
+  color_red="\033[31m"
+  color_green="\033[32m"
+  color_blue="\033[34m"
 fi
 
 strip_esc() {
Signature · 1 line
2.19.1
maintainer Acked-by on v2 2/2
#10 lore raw

Re: [PATCH v2 2/2] selftests/ftrace: Replace \e with \033

Quoted 3 lines · On Fri, 22 Feb 2019 10:10:21 +0100 Juerg Haefliger…

The \e sequence character is not POSIX. Fix that by using \033 instead.

This also looks good to me.

Thank you!

Quoted 26 lines
---
 tools/testing/selftests/ftrace/ftracetest | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/ftracetest +4 -4
index 20c9c0ad8682..136387422b00 100755
@@ -161,10 +161,10 @@ color_green=
 color_blue=
 # If stdout exists and number of colors is eight or more, use them
 if [ -t 1 -a "$ncolors" -ge 8 ]; then
-  color_reset="\e[0m"
-  color_red="\e[31m"
-  color_green="\e[32m"
-  color_blue="\e[34m"
+  color_reset="\033[0m"
+  color_red="\033[31m"
+  color_green="\033[32m"
+  color_blue="\033[34m"
 fi
 
 strip_esc() {
Signature · 1 line
2.19.1
Signature · 1 line
Masami Hiramatsu <[email protected]>
maintainer
#11 lore raw

Re: [PATCH v2 2/2] selftests/ftrace: Replace \e with \033

Quoted 5 lines · Masami Hiramatsu
Quoted 2 lines · On Fri, 22 Feb 2019 10:10:21 +0100 Juerg Haefliger…

The \e sequence character is not POSIX. Fix that by using \033 instead.

Quoted 8 lines
Quoted 1 line

This also looks good to me.

Thank you!

I wasn't on the To or Cc on the original patch. Make sure to run the get_maintainers and include the people it recommends.

Please resend the patch to me, so I can take it for 5.1-rc1

thanks,
-- Shuah

maintainer Acked-by
#12 lore raw

Re: [PATCH v2 2/2] selftests/ftrace: Replace \e with \033

Quoted 12 lines · On Fri, 22 Feb 2019 08:59:42 -0700 shuah <[email protected]> wrote:
Quoted 11 lines · Masami Hiramatsu
Quoted 3 lines · On Fri, 22 Feb 2019 10:10:21 +0100 Juerg Haefliger…

The \e sequence character is not POSIX. Fix that by using \033 instead.

This also looks good to me.

Quoted 8 lines
Quoted 2 lines

Thank you!

I wasn't on the To or Cc on the original patch. Make sure to run the get_maintainers and include the people it recommends.

Please resend the patch to me, so I can take it for 5.1-rc1

And add both Masami and my Acked-by when you send it to Shuah (for both patches).

-- Steve

#13 lore raw

v2 cover selftests/ftrace: Make ftracetest POSIX compliant

In reply to Juerg Haefliger

Add shuah at kernel.org and linux-kselftest at vger.kernel.org.

The recent addition of colored output introduced some non-POSIX-compliant constructs. Fix that.

Juerg Haefliger (2):
selftests/ftrace: Replace echo -e with printf
selftests/ftrace: Replace \e with \033

 tools/testing/selftests/ftrace/ftracetest | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Signature · 1 line
2.19.1
#14 lore raw

PATCH RESEND v2 1/2 selftests/ftrace: Replace echo -e with printf

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(-)
tools/testing/selftests/ftrace/ftracetest +7 -2
index fc755e1b50f1..20c9c0ad8682 100755
@@ -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
Signature · 1 line
2.19.1
#15 lore raw

v2 cover selftests/ftrace: Make ftracetest POSIX compliant

In reply to Juerg Haefliger

Add shuah at kernel.org and linux-kselftest at vger.kernel.org.

The recent addition of colored output introduced some non-POSIX-compliant constructs. Fix that.

Juerg Haefliger (2):
selftests/ftrace: Replace echo -e with printf
selftests/ftrace: Replace \e with \033

 tools/testing/selftests/ftrace/ftracetest | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Signature · 1 line
2.19.1
#16 lore raw

PATCH RESEND v2 1/2 selftests/ftrace: Replace echo -e with printf

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(-)
tools/testing/selftests/ftrace/ftracetest +7 -2
index fc755e1b50f1..20c9c0ad8682 100755
@@ -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
Signature · 1 line
2.19.1
#17 lore raw

v2 cover selftests/ftrace: Make ftracetest POSIX compliant

In reply to Juerg Haefliger

Add shuah at kernel.org and linux-kselftest at vger.kernel.org.

The recent addition of colored output introduced some non-POSIX-compliant constructs. Fix that.

Juerg Haefliger (2):
selftests/ftrace: Replace echo -e with printf
selftests/ftrace: Replace \e with \033

 tools/testing/selftests/ftrace/ftracetest | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Signature · 1 line
2.19.1
#18 lore raw

PATCH RESEND v2 1/2 selftests/ftrace: Replace echo -e with printf

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(-)
tools/testing/selftests/ftrace/ftracetest +7 -2
index fc755e1b50f1..20c9c0ad8682 100755
@@ -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
Signature · 1 line
2.19.1
maintainer
#19 lore raw

Re: [RESEND PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf

Quoted 25 lines · Juerg Haefliger

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(-)
tools/testing/selftests/ftrace/ftracetest +0 -2
index fc755e1b50f1..20c9c0ad8682 100755
@@ -173,8 +173,13 @@ strip_esc() {
  }
 
  prlog() { # messages
-  echo -e "$@"
-  [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE

tools/testing/selftests/ftrace/ftracetest strip_esc() { · line 185

Quoted 10 lines
tools/testing/selftests/ftrace/ftracetest +7 -0
+  newline="\n"
+  if [ "$1" = "-n" ] ; then
+    newline=
+    shift
+  fi
+  printf "$*$newline"
+  [ "$LOG_FILE" ] && printf "$*$newline" | strip_esc >> $LOG_FILE
  }
  catlog() { #file
    cat $1

This patch applied to linux-kselftest next which is at 5.0rc6 I queued this for 5.1-rc1.

thanks,
-- Shuah

#20 lore raw

PATCH RESEND v2 2/2 selftests/ftrace: Replace \e with \033

In reply to Juerg Haefliger

The \e sequence character is not POSIX. Fix that by using \033 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 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/ftracetest +4 -4
index 20c9c0ad8682..136387422b00 100755
@@ -161,10 +161,10 @@ color_green=
 color_blue=
 # If stdout exists and number of colors is eight or more, use them
 if [ -t 1 -a "$ncolors" -ge 8 ]; then
-  color_reset="\e[0m"
-  color_red="\e[31m"
-  color_green="\e[32m"
-  color_blue="\e[34m"
+  color_reset="\033[0m"
+  color_red="\033[31m"
+  color_green="\033[32m"
+  color_blue="\033[34m"
 fi
 
 strip_esc() {
Signature · 1 line
2.19.1
maintainer
#21 lore raw

Re: [RESEND PATCH v2 2/2] selftests/ftrace: Replace \e with \033

Quoted 19 lines · Juerg Haefliger

The \e sequence character is not POSIX. Fix that by using \033 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 | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/ftracetest +0 -1
index 20c9c0ad8682..136387422b00 100755
@@ -161,10 +161,10 @@ color_green=
  color_blue=
  # If stdout exists and number of colors is eight or more, use them
  if [ -t 1 -a "$ncolors" -ge 8 ]; then
-  color_reset="\e[0m"

tools/testing/selftests/ftrace/ftracetest color_green= · line 170

Quoted 10 lines
tools/testing/selftests/ftrace/ftracetest +4 -3
-  color_red="\e[31m"
-  color_green="\e[32m"
-  color_blue="\e[34m"
+  color_reset="\033[0m"
+  color_red="\033[31m"
+  color_green="\033[32m"
+  color_blue="\033[34m"
  fi
 
  strip_esc() {

Which release is this patch based on?

This one failed to apply to linux-kselftest next - I resolved a minor merge conflict and applied it. Please review to make sure it looks good.

thanks,
-- Shuah

#22 lore raw

Re: [RESEND PATCH v2 2/2] selftests/ftrace: Replace \e with \033

Quoted 28 lines · On Fri, 22 Feb 2019 15:46:03 -0700 shuah <[email protected]> wrote:
Quoted 27 lines · Juerg Haefliger

The \e sequence character is not POSIX. Fix that by using \033 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 | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/ftracetest +4 -4
index 20c9c0ad8682..136387422b00 100755
@@ -161,10 +161,10 @@ color_green=
  color_blue=
  # If stdout exists and number of colors is eight or more, use them
  if [ -t 1 -a "$ncolors" -ge 8 ]; then
-  color_reset="\e[0m"
-  color_red="\e[31m"
-  color_green="\e[32m"
-  color_blue="\e[34m"
+  color_reset="\033[0m"
+  color_red="\033[31m"
+  color_green="\033[32m"
+  color_blue="\033[34m"
  fi
 
Quoted 7 lines

tools/testing/selftests/ftrace/ftracetest color_green= · line 170

Quoted 2 lines
tools/testing/selftests/ftrace/ftracetest +0 -0
  strip_esc() {

Which release is this patch based on?

This one failed to apply to linux-kselftest next - I resolved a minor merge conflict and applied it. Please review to make sure it looks good.

Looks good. It didn't apply cleanly because you don't have
https://lore.kernel.org/lkml/20190220153706.24686-1-juergh at canonical.com/T/#u Sorry about not copying you on that patch. Want me to resend?

...Juerg

Quoted 2 lines

thanks,
-- Shuah

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linaro.org/pipermail/linux-kselftest-mirror/attachments/20190223/c0dd0d4f/attachment.sig>

maintainer
#23 lore raw

Re: [RESEND PATCH v2 2/2] selftests/ftrace: Replace \e with \033

Quoted 36 lines · Juerg Haefliger
Quoted 33 lines · On Fri, 22 Feb 2019 15:46:03 -0700 shuah <[email protected]> wrote:
Quoted 19 lines · Juerg Haefliger

The \e sequence character is not POSIX. Fix that by using \033 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 | 8 ++++----
   1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/ftracetest +0 -1
index 20c9c0ad8682..136387422b00 100755
@@ -161,10 +161,10 @@ color_green=
   color_blue=
   # If stdout exists and number of colors is eight or more, use them
   if [ -t 1 -a "$ncolors" -ge 8 ]; then
-  color_reset="\e[0m"

tools/testing/selftests/ftrace/ftracetest color_green= · line 170

Quoted 10 lines
tools/testing/selftests/ftrace/ftracetest +4 -3
-  color_red="\e[31m"
-  color_green="\e[32m"
-  color_blue="\e[34m"
+  color_reset="\033[0m"
+  color_red="\033[31m"
+  color_green="\033[32m"
+  color_blue="\033[34m"
   fi
 
   strip_esc() {

Which release is this patch based on?

Quoted 9 lines
Quoted 2 lines

This one failed to apply to linux-kselftest next - I resolved a minor merge conflict and applied it. Please review to make sure it looks good.

Looks good. It didn't apply cleanly because you don't have
https://lore.kernel.org/lkml/20190220153706.24686-1-juergh at canonical.com/T/#u Sorry about not copying you on that patch. Want me to resend?

...Juerg

Yes. Please.

thanks,
-- Shuah