summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-05-27 20:01:46 +0000
committerjilles <jilles@FreeBSD.org>2011-05-27 20:01:46 +0000
commit5c7c156d1e87d7f343acc5808137d89bd70c871b (patch)
tree8a0532484b27c08786f29c30bbb2d974b0366354 /tools
parent5499b0b9d54eff4cc9b3a16b9a1ed77df9d1f9d9 (diff)
downloadFreeBSD-src-5c7c156d1e87d7f343acc5808137d89bd70c871b.zip
FreeBSD-src-5c7c156d1e87d7f343acc5808137d89bd70c871b.tar.gz
sh: Correct criterion for using CDPATH in cd.
CDPATH should be ignored not only for pathnames starting with '/' but also for pathnames whose first component is '.' or '..'. The man page already describes this behaviour.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/bin/sh/builtins/cd6.010
-rw-r--r--tools/regression/bin/sh/builtins/cd7.015
2 files changed, 25 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/builtins/cd6.0 b/tools/regression/bin/sh/builtins/cd6.0
new file mode 100644
index 0000000..083a061
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/cd6.0
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+set -e
+cd -P /bin
+d=$PWD
+CDPATH=/:
+cd -P .
+[ "$d" = "$PWD" ]
+cd -P ./
+[ "$d" = "$PWD" ]
diff --git a/tools/regression/bin/sh/builtins/cd7.0 b/tools/regression/bin/sh/builtins/cd7.0
new file mode 100644
index 0000000..9adda86
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/cd7.0
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+set -e
+cd /usr/bin
+[ "$PWD" = /usr/bin ]
+CDPATH=/:
+cd .
+[ "$PWD" = /usr/bin ]
+cd ./
+[ "$PWD" = /usr/bin ]
+cd ..
+[ "$PWD" = /usr ]
+cd /usr/bin
+cd ../
+[ "$PWD" = /usr ]
OpenPOWER on IntegriCloud