From c96a993d51e3e5958c8161d0dbe86cb43bcc52c1 Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Tue, 28 Apr 2015 20:42:26 +0100
Subject: 34989: AUTO_CD needs to call cd --.
Otherwise directories looking like options do the wrong thing.
---
ChangeLog | 5 +++++
Src/exec.c | 1 +
2 files changed, 6 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index d53fe38dc..a5987b764 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-28 Peter Stephenson
+
+ * 34989: Src/exec.c: AUTOCD needs to pass -- to cd to avoid
+ directory being treated as option.
+
2015-04-28 Peter Stephenson
* 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;
--
cgit 1.4.1