-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Ralf Wildenhues on 11/22/2008 6:57 AM: > I propose two alternative patches to fix these issues. Both, as the > code before the patch, assume that `test' is a built-in command. Yuck.
But reasonably safe; per http://www.in-ulm.de/~mascheck/bourne/, all System III shells provide this. > + PATH=/empty FPATH=/empty test "X`printf %s $ECHO`" = "X$ECHO"])]) Your attempt to modify PATH in-place won't work. Even with bash 3.2: $ foo=bar echo `env | grep foo` $ In other words, although echo sees the altered $foo, the `` subshell does not. > + ( PATH=/empty FPATH=/empty; export PATH FPATH > + test "X`printf %s $ECHO`" = "X$ECHO" )])]) Yes, that looks more portable (even if it is slower). But do we even need to _AS_DETECT_SUGGEST for a working builtin printf? As long as we search for 'print -r' before 'printf', we are either guaranteed to find the working builtin variant, or we end up resorting to forking no matter which alternative we choose. The primary use case where this will help is with Solaris /bin/sh, which lacks both builtins, so we really _do_ want to suggest a shell that is more likely to provide a builtin. But on a Solaris machine, ksh fails the suggested test (it lacks builtin printf), so ksh is not determined to be better than /bin/sh, and you end up running with /bin/sh and forking for every $ECHO anyway. Maybe a better suggested test would be one that checks for either print or printf (that way, a Solaris machine will let ksh pass the suggested test). Since the overall test is running with stderr silenced, we don't even have to worry about messages about command not found. In other words, why not: _AS_DETECT_SUGGESTED([ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO test "X`print -r -- $ECHO`" = "X$ECHO" \ || test "X`printf %s $ECHO`" = X$ECHO"]) - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkkoF64ACgkQ84KuGfSFAYAGRgCeM3rJDiTmFgdSSOu74dwNqpd+ CmkAnR++b8sDGKRxrWW+ovGcgZqcCJoU =GuTz -----END PGP SIGNATURE-----