tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bug in sh, probably, with test case



On 2012-12-20 18:31, Joerg Sonnenberger wrote:
On Thu, Dec 20, 2012 at 06:30:18PM -0500, Richard Hansen wrote:
What are your thoughts about adopting DASH (the Debian Almquist
Shell)?

It is black listed for pkgsrc.

What does that mean? Does it have to do with this snippet of code in pkgsrc/bootstrap/bootstrap?

# On some newer Ubuntu installations, /bin/sh is a symlink to /bin/dash,
# whose echo(1) is not BSD-compatible.
dash_echo_test=`$bootstrap_sh -c 'echo "\\100"'`
if [ "$dash_echo_test" = "@" ]; then
        { echo "ERROR: Your shell's echo command is not BSD-compatible."
          echo "ERROR: Please select another shell by setting the environment"
          echo "ERROR: variable SH."
        } 1>&2
        exit 1;
fi

The above code is interesting because POSIX XSI conformance requires 'echo "\\100"' to output @. It's also trivial to work around:

    portable_echo() { printf %s\\n "$*"; }

Thanks,
Richard


Home | Main Index | Thread Index | Old Index