[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] docs: mention cd limitation
From: |
Eric Blake |
Subject: |
[PATCH 1/2] docs: mention cd limitation |
Date: |
Thu, 29 Jul 2010 16:24:10 -0600 |
* 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.
+
See @xref{Special Shell Variables}, for portability problems involving
@command{cd} and the @env{CDPATH} environment variable.
Also please see the discussion of the @command{pwd} command.
--
1.7.2
- [PATCH 1/2] docs: mention cd limitation,
Eric Blake <=