From: Eric Blake Date: Wed, 7 Mar 2012 18:11:58 +0000 (-0700) Subject: docs: document set -n pitfalls X-Git-Tag: v2.69~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=943789e03f5d3041e223e439dde8851484e2d99a;p=thirdparty%2Fautoconf.git docs: document set -n pitfalls * doc/autoconf.texi (Limitations of Builtins) : Document issues with set -n. --- diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 9442e224..2ae8bb93 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -18083,6 +18083,26 @@ cim c @end example +@cindex @command{set -n} +Use of @command{set -n} (typically via @command{sh -n script}) to +validate a script is not foolproof. Modern @command{ksh93} tries to be +helpful by informing you about better syntax, but switching the script +to use the suggested syntax in order to silence the warnings would +render the script no longer portable to older shells: + +@example +$ @kbd{ksh -nc '``'} +ksh: warning: line 1: `...` obsolete, use $(...) +0 +@end example + +Furthermore, on ancient hosts, such as SunOS 4, @command{sh -n} could go +into an infinite loop; even with that bug fixed, Solaris 8 +@command{/bin/sh} takes extremely long to parse large scripts. Autoconf +itself uses @command{sh -n} within its testsuite to check that correct +scripts were generated, but only after first probing for other shell +features (such as @code{test -n "$@{BASH_VERSION+set@}"}) that indicate +a reasonably fast and working implementation. @item @command{shift} @c ------------------