diff options
author | Eric Blake <eblake@redhat.com> | 2012-03-07 11:11:58 -0700 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-03-07 11:16:38 -0700 |
commit | 943789e03f5d3041e223e439dde8851484e2d99a (patch) | |
tree | f482c66475eae25b0f840f73373c8efe60ec96c5 | |
parent | da4121067329547fcbb9b1765c65f884599b2631 (diff) | |
download | autoconf-943789e03f5d3041e223e439dde8851484e2d99a.tar.gz |
docs: document set -n pitfalls
* doc/autoconf.texi (Limitations of Builtins) <set>: Document
issues with set -n.
-rw-r--r-- | doc/autoconf.texi | 20 |
1 files changed, 20 insertions, 0 deletions
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 ------------------ |