From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1758 invoked by alias); 28 Apr 2015 19:38:17 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34989 Received: (qmail 4713 invoked from network); 28 Apr 2015 19:38:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Originating-IP: [80.3.228.158] X-Spam: 0 X-Authority: v=2.1 cv=VLdTnr/X c=1 sm=1 tr=0 a=P+FLVI8RzFchTbbqTxIDRw==:117 a=P+FLVI8RzFchTbbqTxIDRw==:17 a=kj9zAlcOel0A:10 a=NLZqzBF-AAAA:8 a=7YfXLusrAAAA:8 a=xIHczoh3rEkNOSUmC5UA:9 a=CjuIK1q_8ugA:10 Date: Tue, 28 Apr 2015 20:32:25 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: AUTO_CD and directory names of options Message-ID: <20150428203225.00ccbdc7@ntlworld.com> In-Reply-To: <553FD348.6000606@gmx.com> References: <553FD348.6000606@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 28 Apr 2015 14:36:56 -0400 Eric Cook 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 Web page now at http://homepage.ntlworld.com/p.w.stephenson/