about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-04-28 20:42:26 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-04-28 20:42:26 +0100
commitc96a993d51e3e5958c8161d0dbe86cb43bcc52c1 (patch)
tree6b19249e983f72faa4be597d7efb581875984e08
parent4096469b345224a9c1a7c8160ffb63cd4b7e6dc3 (diff)
downloadzsh-c96a993d51e3e5958c8161d0dbe86cb43bcc52c1.tar.gz
zsh-c96a993d51e3e5958c8161d0dbe86cb43bcc52c1.tar.xz
zsh-c96a993d51e3e5958c8161d0dbe86cb43bcc52c1.zip
34989: AUTO_CD needs to call cd --.
Otherwise directories looking like options do the wrong thing.
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d53fe38dc..a5987b764 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-28  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 34989: Src/exec.c: AUTOCD needs to pass -- to cd to avoid
+	directory being treated as option.
+
 2015-04-28  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* Jared Ahern: 34980: Completion/Unix/Command/_make: expanding
diff --git a/Src/exec.c b/Src/exec.c
index 31c80a74e..6a8b35a36 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2930,6 +2930,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 	 * is a directory we should AUTOCD to. */
 	if (!hn && trycd && (s = cancd(peekfirst(args)))) {
 	    peekfirst(args) = (void *) s;
+	    pushnode(args, dupstring("--"));
 	    pushnode(args, dupstring("cd"));
 	    if ((hn = builtintab->getnode(builtintab, "cd")))
 		is_builtin = 1;