Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

sh compatibility issue



Hi.

I have encountered a minor compatibility issue when using zsh in place
of /bin/sh on FreeBSD.

When attempting to compile the base system, it gets the error

    /usr/src/gnu/usr.bin/binutils/ld/genscripts.sh:43: parse error near `)'
    *** Error code 1

The error comes from this piece of code in genscripts.sh

    # XXX: arm hack : until those file are merged back into the FSF repo,
    # just
    # use the version in this directory.
    if !(test -f ${CUSTOMIZER_SCRIPT}"";) then
    CUSTOMIZER_SCRIPT="${srcdir}/emulparams/${EMULATION_NAME}.sh"
    fi

What is happening is that zsh does not like the '!' being next to the
opening '(' without a space in the if condition.  In my opinion, this is
kind of an unorthodox syntax.  I'm not even sure if it is traditionally
legal sh or ksh syntax.  Nevertheless, it works with BSD sh and bash.
A simple test is

    if !(echo hello); then echo "XXXX"; fi
    if ! (echo hello); then echo "XXXX"; fi

Zsh works fine in the second case, with a space after the '!'.

I also tested without the space under ksh on NetBSD and got a strange
result.  It ran the mail utility.  Weird.

My question is, is it possible and reasonable to modify zsh to work
without the space so that screwy GNU software such as this will compile?

Regards,
Vince




Messages sorted by: Reverse Date, Date, Thread, Author