A ftrace selftest just failed due to the differences between bash and dash on how they interpret backslashes (\
).
Bash will evaluate it once, where as dash will evaluate it every time.
i=123
TEST="\\$i"
echo "$TEST"
Bash will show: \123
where as dash will echo out the escape sequence of “123”.
A kprobe event self test needed to test the max number of arguments, where each argument held a backslash followed by a number. It created it with the loop:
TEST_STRING=$1
# Acceptable
for i in `seq 1 $MAX_ARGS`; do
TEST_STRING="$TEST_STRING \\$i"
done
echo "$TEST_STRING" >> dynamic_events
Which worked fine when /bin/sh
was bash, but when /bin/sh
was dash, it failed!
And checkbashisms did NOT catch it!