Hello, * Jim Meyering wrote on Sat, Nov 06, 2010 at 02:55:47PM CET: > Jim Meyering wrote: > > Andreas Schwab wrote: > >> Jim Meyering writes: > >>> cat <<\EOF > init.cfg > >>> f() > >>> { > >>> case $IFS in '') exit 91;; esac > >>> local s=$IFS > >>> case $s in '') exit 97;; esac > >>> } > >>> f > >>> EOF > >>> $ /bin/sh -c '. init.cfg' > >>> [Exit 97] > >> > >> Perhaps local isn't really the builtin local?
> Subject: [PATCH] init.sh: disqualify FreeBSD 8.1's /bin/sh > > * tests/init.sh: Arrange not to accept FreeBSD 8.1's /bin/sh, since > it fails this test: /bin/sh -c 'f(){ local s=$IFS; test -n "$s"; }; f' > @@ -115,6 +118,7 @@ fi > # ? - not ok > gl_shell_test_script_=' > test $(echo y) = y || exit 1 > +gl_local_test_(){ local s=$IFS; test -n "$s"; }; gl_local_test_ || exit 1 There may be two issues at work here: - there is no requirement that sh does not white-space-split the right hand side of a 'local' assignment, 'local' isn't standardized anywhere. At least one version of dash is guilty here. - Posix does not require IFS to be set upon script startup. It only requires that, if IFS is unset, word splitting ought to behave as if it were set to space, tab, and newline, in that order. That is why the startup code of all autotools scripts explicitly sets IFS, so that saving and restoring works. Cheers, Ralf