two small bugs in the shell

Trek trek00 at inbox.ru
Wed Jan 20 22:33:47 UTC 2016


the first bug I found is in the substring processing

with a posix shell:

 $ sh -c 's=OK\\n; echo "${s%%\\n*}"'
 OK

but with busybox:

 $ busybox sh -c 's=OK\\n; echo "${s%%\\n*}"'
 OK\

the other expansions %, # and ## are affected too


the second one is related to the \c escape sequence

with a posix shell:

  $ sh -c 'printf %b OK\\c'
  OK

with busybox:

  $ busybox sh -c 'printf %b OK\\c'
  OK\c

and the same applies to echo


I'm using the version 1.22.0-9 included in Debian GNU/Linux 8 (jessie)

c-ya!

----
small ad: I discovered this bug developing a small shell library that
you can find at http://www.trek.eu.org/devel/naive/naive-0.0.2.tar.gz


More information about the busybox mailing list