[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] document shell function problems
From: |
Eric Blake |
Subject: |
Re: [PATCH] document shell function problems |
Date: |
Fri, 05 Oct 2007 13:25:18 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Paolo Bonzini on 10/5/2007 3:17 AM:
> Here is what I could gather from reports on address@hidden In
> particular http://www.mail-archive.com/address@hidden/msg15966.html
> suggested me the following minimal reproducer
>
> test -n "${ZSH_VERSION+set}" && emulate sh
> failure1 () {
> (exit 1)
> echo $?
> }
Should we add this into m4sh's _AS_DETECT_SUGGESTED_BODY, to skip zsh when
something better is present?
> +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!
Is unset supported by all shells that also support functions? That would
be a nice simplification to rely on.
> +
> +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.
>
Looks good, please apply.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHBo+e84KuGfSFAYARAh9JAJ9N/dr/CxUzZkQ79PokFdvNPXjSbACdG7Ty
CJVPPEumnGhZ9oTscu+r9l4=
=Vrwv
-----END PGP SIGNATURE-----