* Cannot cd into --
@ 2008-02-29 21:10 Matthias B.
2008-02-29 21:12 ` Mikael Magnusson
2008-03-02 21:17 ` Peter Stephenson
0 siblings, 2 replies; 4+ messages in thread
From: Matthias B. @ 2008-02-29 21:10 UTC (permalink / raw)
To: zsh-workers
It doesn't seem to be possible with zsh to cd into a directory named --.
In bash I can do this with
cd -- --
but that doesn't work with zsh 4.3.5.
MSB
--
The early bird gets the worm, but the second mouse gets the cheese.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Cannot cd into --
2008-02-29 21:10 Cannot cd into -- Matthias B.
@ 2008-02-29 21:12 ` Mikael Magnusson
2008-02-29 21:35 ` Matthias B.
2008-03-02 21:17 ` Peter Stephenson
1 sibling, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2008-02-29 21:12 UTC (permalink / raw)
To: zsh-workers
On 29/02/2008, Matthias B. <msbREMOVE-THIS@winterdrache.de> wrote:
> It doesn't seem to be possible with zsh to cd into a directory named --.
> In bash I can do this with
>
> cd -- --
>
> but that doesn't work with zsh 4.3.5.
cd ./--
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Cannot cd into --
2008-02-29 21:12 ` Mikael Magnusson
@ 2008-02-29 21:35 ` Matthias B.
0 siblings, 0 replies; 4+ messages in thread
From: Matthias B. @ 2008-02-29 21:35 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: zsh-workers
On Fri, 29 Feb 2008 22:12:32 +0100 "Mikael Magnusson" <mikachu@gmail.com>
wrote:
> On 29/02/2008, Matthias B. <msbREMOVE-THIS@winterdrache.de> wrote:
> > It doesn't seem to be possible with zsh to cd into a directory named
> > --.
> > In bash I can do this with
> >
> > cd -- --
> >
> > but that doesn't work with zsh 4.3.5.
>
> cd ./--
>
Ah. I see. Still I think it would be good to implement the other form as
well, since -- is commonly used for this purpose.
MSB
--
Socialism might have worked, had it been more social and less ism.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Cannot cd into --
2008-02-29 21:10 Cannot cd into -- Matthias B.
2008-02-29 21:12 ` Mikael Magnusson
@ 2008-03-02 21:17 ` Peter Stephenson
1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2008-03-02 21:17 UTC (permalink / raw)
To: zsh-workers
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-02 21:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-29 21:10 Cannot cd into -- Matthias B.
2008-02-29 21:12 ` Mikael Magnusson
2008-02-29 21:35 ` Matthias B.
2008-03-02 21:17 ` Peter Stephenson
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).