Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command

2020-05-28 Thread Shuah Khan
On 5/25/20 3:59 AM, Masami Hiramatsu wrote: Hi Shuah, Could you pick this to kselftest-next? Thank you, On Mon, 11 May 2020 22:36:27 +0900 Masami Hiramatsu wrote: Since the built-in echo has different behavior in POSIX shell (dash) and bash, kprobe_syntax_errors.tc can fail on dash which in

Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command

2020-05-25 Thread Masami Hiramatsu
Hi Shuah, Could you pick this to kselftest-next? Thank you, On Mon, 11 May 2020 22:36:27 +0900 Masami Hiramatsu wrote: > Since the built-in echo has different behavior in POSIX shell > (dash) and bash, kprobe_syntax_errors.tc can fail on dash which > interpret backslash escape automatically. >

Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command

2020-05-11 Thread Steven Rostedt
On Mon, 11 May 2020 14:59:20 + David Laight wrote: > > > echo "Test command: $command" > > > echo > error_log > > > -(! echo "$command" >> "$3" ) 2> /dev/null > > > +(! printf "%s" "$command" >> "$3" ) 2> /dev/null > > WTF is the (! for ?? > The (...) is a subshell. > And

RE: [PATCH v2] selftests/ftrace: Use printf for backslash included command

2020-05-11 Thread David Laight
> > +pos=$(printf "%s" "${2%^*}" | wc -c) # error position > > +command=$(printf "%s" "$2" | tr -d ^) You may want to put all the $(...) inside "" to avoid field splitting (not relevant to a shell assignment with modern shells) and filename globbing. > > echo "Test command: $command"

Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command

2020-05-11 Thread Masami Hiramatsu
On Mon, 11 May 2020 13:46:35 + David Laight wrote: > From: Masami Hiramatsu > > Sent: 11 May 2020 14:38 > > > > Hi Andreas and David, > > > > OK, what about this fix? > > No idea what it is trying to do or why. > Just a way of avoiding the differences between SYSV and BSD /bin/echo. > > I

Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command

2020-05-11 Thread Masami Hiramatsu
On Mon, 11 May 2020 15:42:10 +0200 Andreas Schwab wrote: > On Mai 11 2020, Masami Hiramatsu wrote: > > > -(! echo "$command" >> "$3" ) 2> /dev/null > > +(! printf "%s" "$command" >> "$3" ) 2> /dev/null > > printf %s does not print a newline, you need printf '%s\n' for that. Actually, f

RE: [PATCH v2] selftests/ftrace: Use printf for backslash included command

2020-05-11 Thread David Laight
From: Masami Hiramatsu > Sent: 11 May 2020 14:38 > > Hi Andreas and David, > > OK, what about this fix? No idea what it is trying to do or why. Just a way of avoiding the differences between SYSV and BSD /bin/echo. IIRC Posix allows both behaviours (and probably others). David - Regis

Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command

2020-05-11 Thread Andreas Schwab
On Mai 11 2020, Masami Hiramatsu wrote: > -(! echo "$command" >> "$3" ) 2> /dev/null > +(! printf "%s" "$command" >> "$3" ) 2> /dev/null printf %s does not print a newline, you need printf '%s\n' for that. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB4

Re: [PATCH v2] selftests/ftrace: Use printf for backslash included command

2020-05-11 Thread Masami Hiramatsu
Hi Andreas and David, OK, what about this fix? On Mon, 11 May 2020 22:36:27 +0900 Masami Hiramatsu wrote: > Since the built-in echo has different behavior in POSIX shell > (dash) and bash, kprobe_syntax_errors.tc can fail on dash which > interpret backslash escape automatically. > > To fix thi