From 32680ce83e1a886a15e08739195207d65e2165c2 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 6 Oct 2007 11:25:49 +0200 Subject: [PATCH] document shell function portability 2007-10-06 Paolo Bonzini * doc/autoconf.texi (Shell portability): Document shell function portability. Signed-Off-By: Paolo Bonzini --- ChangeLog | 5 +++++ doc/autoconf.texi | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96a73aea..159ba5b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-10-06 Paolo Bonzini + * doc/autoconf.texi (Shell portability): Document shell function + portability. + +2007-10-06 Paolo Bonzini + * lib/autotest/general.m4 (AT_INIT): Add at_func_diff_devnull, at_func_check_skip, at_func_check_status, at_func_filter_trace, at_func_log_failure shell functions. Use test -s to avoid diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 1d097f2b..423a8830 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -11412,10 +11412,20 @@ have evolved over the years, but to prevent trouble, do not take advantage of features that were added after Unix version 7, circa 1977 (@pxref{Systemology}). -You should not use shell functions, aliases, negated character -classes, or other features that are not found in all Bourne-compatible -shells; restrict yourself to the lowest common denominator. Even -@code{unset} is not supported by all shells! +You should not use aliases, negated character classes, or other features +that are not found in all Bourne-compatible shells; restrict yourself +to the lowest common denominator. Even @code{unset} is not supported +by all shells! + +Shell functions are considered portable nowadays, though Autoconf +still does not use them (Autotest does). However, inside a shell +function you should not be using @code{$?} to check the return code +of a subshell invocation; in general, since the caller of a shell +function might look at the function's return code, make sure that the +last statement of a shell function does not invoke a subshell. +Using subshells triggers bugs in zsh 4.x; while Autoconf tries +to find a shell that does not exhibit the bug, zsh might be the +only shell present on the user's machine. Some ancient systems have quite small limits on the length of the @samp{#!} line; for instance, 32 -- 2.11.4.GIT