Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: cd bugs



On Wed, 15 Jul 2009 03:28:53 +0000 (UTC)
Eric Blake <ebb9@xxxxxxx> wrote:
> Eric Blake <ebb9 <at> byu.net> writes:
> 
> > $ zsh -c 'emulate -R sh; CDPATH=///; cd eblake; /bin/pwd'
> > //eblake
> > $ bash -c 'CDPATH=///; cd eblake; /bin/pwd'
> > bash: line 0: cd: eblake: No such file or directory
> > /tmp
> > $
> 
> Of the three examples mentioned in this thread, this one is definitely a bug,
> but one that only affects platforms where // is special (which, based on the
> __CYGWIN__ conditional in the source, appears to be just cygwin).

Thanks, I've committed it.

> Actually, in looking at this patch again, I'm starting to wonder if it
> might be better to teach tricat that if the first argument ends in '/'
> and the second argument is exactly "/", then it does not need to use the
> second argument; this would certainly make it touch all code paths that
> do file name concatenation, rather than trying to change down and protect
> every caller of tricat with __CYGWIN__ conditionals.  In other words,
> there are probably also bugs with ~ expansion when $HOME is exactly / or
> //, as well as other potential gotchas with // handling that I haven't
> even investigated here.

It would probably be better to introduce a pathtricat(), since tricat()
isn't necessarily tied to paths; but it's possible similar issues occur
with dupstring() or ztrdup(), too.  It's certainly a danger this could
happen elsewhere.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


'member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom'



Messages sorted by: Reverse Date, Date, Thread, Author