[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proposed doc updates

From: Noah Misch
Subject: Re: Proposed doc updates
Date: Tue, 25 Jan 2005 18:07:23 -0800
User-agent: Mutt/1.5.6i

On Mon, Jan 24, 2005 at 06:22:04AM -0700, Eric Blake wrote:
> 2005-01-24  Eric Blake  <address@hidden>
>       * doc/autoconf.texi (Portable Shell): Autoconf uses functions.

_AS_SHELL_FN_SPY tries trivial shell functions in a protected subshell so we can
raise a warning asking the user to report his or her function-ignorant shell to
address@hidden  Is that not the only use?

> --- doc/autoconf.texi 21 Jan 2005 19:31:51 -0000      1.866
> +++ doc/autoconf.texi 24 Jan 2005 13:16:04 -0000
> @@ -9503,11 +9503,12 @@ have evolved over the years, but to prev
>  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
> address@hidden is not supported by all shells!  Also, include a space
> -after the exclamation point in interpreter specifications, like this:
> +You should use shell functions with care, and should avoid aliases,

Please do not write `with care' or `carefully' in technical documentation; it
does not provide usable guidance.

> @@ -9569,7 +9573,8 @@ Ash is often used on @acronym{GNU}/Linux
>  systems as a light-weight Bourne-compatible shell.  Ash 0.2 has some
>  bugs that are fixed in the 0.3.x series, but portable shell scripts
>  should work around them, since version 0.2 is still shipped with many
> address@hidden/Linux distributions.
> address@hidden/Linux distributions.  The version 0.3.x series is the
> +default @command{/bin/sh} of Cygwin.

Ash is the BSD /bin/sh.  It has been ported for the listed purposes.

> +Ash checks that a command exists and is executable before performing
> +redirections.  Therefore, a warning will escape to stderr.  The portable
> +way to check for a command's existance is to redirect stderr of the
> +subshell performing the check.
> +
> address@hidden
> +$ @kbd{nonexistant 2> /dev/null}
> address@hidden: not found
> +$ @kbd{(nonexistant) 2> /dev/null}

{ nonexistant; } 2>/dev/null also works, at least on the version of Ash I have
handy.  It has the benefit of not forking.

> address@hidden PATH
> address@hidden PATH
> +Not all @env{PATH} names are portable.  This is particularly noticeable
> +in a default Cygwin installation, where @env{PATH} is inherited from the
> address@hidden path, and typically includes directory components with
> +spaces, such as @code{Program Files} or @code{Documents and Settings}.
> +When handling a @code{$PATH} from a user, quote the variable to avoid
> +inadvertant word splitting or other unexpected behavior.
> +
> address@hidden
> +$ @kbd{echo $PATH}
> +/usr/bin:/cygdrive/c/windows:/cygdrive/c/program files/program
> +$ @kbd{eval PATH=/bin:$PATH}
> address@hidden: files/program: command not found
> address@hidden example
> +
> +Remember that Posix requires that a leading or trailing
> address@hidden in a @env{PATH} implies the current directory.
> +This applies to other @env{PATH}-like variables as well, such as
> address@hidden  Therefore, if you do not want to add @samp{.} to
> +a search path, first check that the path variable is not empty.

This is not a portability issue; I would omit it.

Please spell-correct your new text.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]