This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: enable Ada test suite
On Oct 29, 2003, "Zack Weinberg" <zack@codesourcery.com> wrote:
> I see extensive use of this construct in run_all.sh.
It looks hopelessly unportable :-( If it's meant to be portable, it
almost has to be rewritten from scratch.
There's a shell portability guide in the autoconf manual. Some notes
I can point out:
It uses (and the patch under discussion introduces) shell functions
that are regarded as an almost-portable feature. Not all shells
support shell functions, but all known systems offer at least one
built-in shell that supports them.
It doesn't seem very careful with regards to quoting of variable
expansions to prevent accidental word-splitting. In particular, $* is
generally to be avoided. ${1+"$@"} is the portable and correct
choice, except when you actually want word-splitting.
Using $* as a command is a very bad idea. Not only would "$@" be a
far better choice, but also there are shells that break when an
argument expression expands to the command name. You're better off
with something like: cmd=$1; shift; $cmd ${1+"$@"}
Instead of mkdir -p, it would be more portable to use the
`${CONFIG_SHELL-/bin/sh} mkinstalldirs' command.
The sed commands would break should $dir (computed from `pwd`) contain
a comma.
cp -pr is not portable. GCC uses one of tar, cpio or cp to the same
effect, depending on configure tests.
[ ... -ne ... ] is not as portable as [ ... != ... ]
cut, comm and wc are not portable, but I suppose they're ok to require
in this case.
Other than that, it looks sort of reasonable.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer