autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] docs: mention cd limitation


From: Stefano Lattarini
Subject: Re: [PATCH 1/2] docs: mention cd limitation
Date: Fri, 30 Jul 2010 01:53:25 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

At Friday 30 July 2010, Eric Blake wrote:
> * doc/autoconf.texi (Limitations of Builtins) <cd>: Document
> issues with empty argument.
> 
> Signed-off-by: Eric Blake <address@hidden>
> ---
> 
> Pushing both of these, to address recent issues brought up on the
> list.
> 
>  ChangeLog         |    6 ++++++
>  doc/autoconf.texi |   10 ++++++++++
>  2 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 662a6e1..278a565 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,9 @@
> +2010-07-29  Eric Blake  <address@hidden>
> +
> +     docs: mention cd limitation
> +     * doc/autoconf.texi (Limitations of Builtins) <cd>: Document
> +     issues with empty argument.
> +
>  2010-07-29  Ralf Wildenhues  <address@hidden>
> 
>       Add missing index entries to manual.
> diff --git a/doc/autoconf.texi b/doc/autoconf.texi
> index fac50b2..493b9dc 100644
> --- a/doc/autoconf.texi
> +++ b/doc/autoconf.texi
> @@ -16543,6 +16543,16 @@ Limitations of Builtins
>  variables like @code{ac_top_srcdir} (@pxref{Configuration
> Actions}), so it is safe to @command{cd} to these variables.
> 
> +Posix states that behavior is undefined if @command{cd} is given an
> +explicit empty argument.  Some shells do nothing, some change to the 
> +first entry in @env{CDPATH}, some change to @env{HOME}, and some exit
> +the shell rather than returning an error.  Unfortunately, this means
> +that if @samp{$var} is empty, then @samp{cd "$var"} is less predictable
> +than @samp{cd $var} (at least the latter is well-behaved in all shells
> +at changing to @env{HOME}, although this is probably not what you wanted
> +in a script).  You should check that a directory name was supplied
> +before trying to change locations.
> +
FWIW, I'd never thought such a schizophrenic behaviour was possible, so I
find your documention patch very useful.

Regards,
  Stefano




reply via email to

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