Vincent van Leeuwen | 15 Jul 17:02

problem changing to userdirs with a . in them

Hello,

On some of our servers, customers have usernames with a . in them, of the form 
domain.tld. With zsh I'm having the following problem when trying to change to 
their user homedirs:

# zsh -f
# cd ~domai<tab>
# cd ~domain.tld
cd: no such file or directory: ~domain.tld
# 

(slightly edited to strip hostnames and such)

Autocompletion works perfectly, but it seems the zsh 'cd' builtin doesn't 
recognise usernames with a . in them. With other usernames everything works as 
expected.

This is zsh 4.3.6 (i686-pc-linux-gnu) from the Debian 4.3.6-4 package in the 
lenny (testing) distribution.

Is this something I can solve myself in some way or is this a zsh bug?

Regards,

Vincent van Leeuwen
Media Design - http://www.mediadesign.nl/

Peter Stephenson | 15 Jul 17:20
Favicon

Re: problem changing to userdirs with a . in them

Vincent van Leeuwen wrote:
> On some of our servers, customers have usernames with a . in them, of
> the form domain.tld.

This isn't currently handled in ~ expansion.

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.195
diff -u -r1.195 utils.c
--- Src/utils.c	1 Jul 2008 08:36:02 -0000	1.195
+++ Src/utils.c	15 Jul 2008 15:13:16 -0000
@@ -2981,7 +2991,7 @@
 	typtab[t0] = IALPHA | IALNUM | IIDENT | IUSER | IWORD;
 #endif
     typtab['_'] = IIDENT | IUSER;
-    typtab['-'] = IUSER;
+    typtab['-'] = typtab['.'] = IUSER;
     typtab[' '] |= IBLANK | INBLANK;
     typtab['\t'] |= IBLANK | INBLANK;
     typtab['\n'] |= INBLANK;

--

-- 
Peter Stephenson <pws <at> csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

Vincent van Leeuwen | 15 Jul 17:49

Re: problem changing to userdirs with a . in them

On Tue, Jul 15, 2008 at 04:20:05PM +0100, Peter Stephenson wrote:
> Vincent van Leeuwen wrote:
> > On some of our servers, customers have usernames with a . in them, of
> > the form domain.tld.
> 
> This isn't currently handled in ~ expansion.
> 
> Index: Src/utils.c
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
> retrieving revision 1.195
> diff -u -r1.195 utils.c
> --- Src/utils.c	1 Jul 2008 08:36:02 -0000	1.195
> +++ Src/utils.c	15 Jul 2008 15:13:16 -0000
> @@ -2981,7 +2991,7 @@
>  	typtab[t0] = IALPHA | IALNUM | IIDENT | IUSER | IWORD;
>  #endif
>      typtab['_'] = IIDENT | IUSER;
> -    typtab['-'] = IUSER;
> +    typtab['-'] = typtab['.'] = IUSER;
>      typtab[' '] |= IBLANK | INBLANK;
>      typtab['\t'] |= IBLANK | INBLANK;
>      typtab['\n'] |= INBLANK;
> 

Excellent, this patch works. Thanks for the speedy help! And I see you've 
already checked this into the CVS repo, you're my new hero ;)

Vincent van Leeuwen
Media Design - http://www.mediadesign.nl/
(Continue reading)


Gmane