Search code examples
shellubuntuposixdash-shell

Why can "dash -c ':'" fail with dash 0.5.8 built from source?


With a dash binary compiled from source (version 0.5.8, available at http://gondor.apana.org.au/~herbert/dash/files/dash-0.5.8.tar.gz), executing

dash -c ':'

fails with

dash: 1: :: Permission denied

This means that constructs such as

case foo in
*bar*) :
   do_stuff ;;
*) :
   ;;
esac

fails, which breaks a lot of scripts. Why do the dash binary distributed with ubuntu not have this problem?


Solution

  • If LC_ALL is set to collation order which differs from the ASCII byte-order default (LC_ALL=C), mkbuiltins can generate an array in builtins.c in which bsearch() can fail to find builtins.

    This is definitely a bug, and should be reported upstream.