testsuite and "bashisms"

Michael Tokarev mjt at tls.msk.ru
Sun Nov 10 15:25:36 UTC 2013


Another question/issue with the testsuite.
'
The testsuite uses ${var/search/replace} construct
heavily.  It is implemented in bash and in busybox
ash, but not, for example, in dash, and it is not
in POSIX either.

So when the system /bin/sh does not implement this
construct, los of tests fails like this:

  $ ./pidof.tests
  PASS: pidof (exit with error)
  PASS: pidof (exit with success)
  PASS: pidof this
  pidof.tests: 59: pidof.tests: Bad substitution

(this is actually in testing.sh:59, not pidof.tests:59).
The line in question is:

   optional()
   {
         SKIP=
         while test "$1"; do
                 if test x"${OPTIONFLAGS/*:$1:*/y}" != x"y"; then

which uses this very construct.

I can modify runtest script to explicitly run the
tests using busybox's ash (by prepending `busybox sh' to
the command line).  But this will lead to failing this
very `pidof' test:

  $ busybox sh pidof.tests
  PASS: pidof (exit with error)
  PASS: pidof (exit with success)
  FAIL: pidof this

because it will be unable to "this" process by its
name (pidof.tests), since it will be named `busybox'
instead.

Also, when explicitly using busybox ash, we assume
that the configuration actually includes ash, which
is not always the case.

Is there any interest in fixing these usages of
this problematic variable substitution, or applying
a workaround?

Thanks,

/mjt


More information about the busybox mailing list