From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk
Subject: Re: Cannot cd into --
Date: Sun, 2 Mar 2008 21:17:44 +0000 [thread overview]
Message-ID: <20080302211744.50698d10@pws-pc> (raw)
In-Reply-To: <20080229221008.2c5d417e@buddha>
On Fri, 29 Feb 2008 22:10:08 +0100
"Matthias B." <msbREMOVE-THIS@winterdrache.de> wrote:
> It doesn't seem to be possible with zsh to cd into a directory named --
>
> cd -- --
That's a bug, but possible not as egregious as you think: "cd --
-<number>" changes to an entry on the directory stack (and it's
special-cased so you don't need the leading "--"). There's no way
around that, so if the directory were called "-2" you'd still need to use
"./-2". Here it was treating the second - as a truncated negative
number. This just fixes cd---I'm not sure if the shell should ever
treat a - on its own in that fashion.
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.187
diff -u -r1.187 builtin.c
--- Src/builtin.c 18 Feb 2008 03:18:03 -0000 1.187
+++ Src/builtin.c 2 Mar 2008 21:14:18 -0000
@@ -835,7 +835,8 @@
char *end;
doprintdir++;
- if (argv[0][1] && (argv[0][0] == '+' || argv[0][0] == '-')) {
+ if (argv[0][1] && (argv[0][0] == '+' || argv[0][0] == '-')
+ && strspn(argv[0]+1, "0123456789") == strlen(argv[0]+1)) {
dd = zstrtol(argv[0] + 1, &end, 10);
if (*end == '\0') {
if ((argv[0][0] == '+') ^ isset(PUSHDMINUS))
--
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
prev parent reply other threads:[~2008-03-02 21:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-29 21:10 Matthias B.
2008-02-29 21:12 ` Mikael Magnusson
2008-02-29 21:35 ` Matthias B.
2008-03-02 21:17 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080302211744.50698d10@pws-pc \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).