Skip to contentSkip to conversation

kprobe/kprobe_syntax_errors.tc faild on dash due to sh I/O error

DISCUSSION Masami Hiramatsu 1 participant 1 message May 1, 2020 1 message not in the archive Kselftest

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Liu,

Quoted 15 lines · On Wed, 29 Apr 2020 15:13:20 +0800 Liu Yiding <[email protected]> wrote:

Hi, all.

I met a funny error when i run kprobe_syntax_errors

```

root@vm-snb-35 
/usr/src/linux-selftests-x86_64-rhel-7.6-kselftests-ae83d0b416db002fe95601e7f97f64b59514d936/tools/testing/selftests/ftrace# 
./ftracetest -vvv test.d/kprobe/kprobe_syntax_errors.tc [snip] + expr 13 
+ 0 + test 13 -eq 13 + echo p:kprobes/testevent _do_fork abcd=\1 sh: 
echo: I/O error

```
Quoted 3 lines

This error only happend on dash, use bash run this test is ok.

backslash ('\1') will be transferred into empty in dash.

Oops, good catch! I found that came from the built-in echo command behavior.
Bash's echo doesn't interpret the backslash escape, but dash's POSIX-compliant echo does.

----<dash>----

$ a='\1'
$ b=`echo $a`
$ test "$a" = "$b" && echo "same!" || echo "different"
different

----<bash>----

$ a='\1'
$ b=`echo $a`
$ test "$a" = "$b" && echo "same!" || echo "different"
same!

OK, I'll fix it.

Thank you!

Signature · 1 line
Masami Hiramatsu <[email protected]>