Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: AUTO_CD and directory names of options
On Tue, 28 Apr 2015 14:36:56 -0400
Eric Cook <llua@xxxxxxx> wrote:
> Hey, someone on irc noticed something interesting about AUTO_CD.
>
> If autocd attempts to cd into a directory that is a valid option for cd,
> the option is interpreted like normal
> and the directory doesn't change.
It's actualy worse; it's interpreted as a complete command. So '-q'
will silently change to the home directory.
diff --git a/Src/exec.c b/Src/exec.c
index 31c80a7..6a8b35a 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;
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author