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

Re: `cd .` in non-existent directory leads into weird corner case



On Mon, 2 Apr 2012 12:15:59 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> Weird, when I try making a directory and remove it, I can still cd ..
> to the parent...

That's not weird; the shell remembers PWD because by default it changes
directory logically rather than physically, i.e. retaining symbolic
links in the path, so it changes to the parent directory by what
amounts to 'cd $PWD:h'.

What you get with CHASE_LINKS or cd -P is another matter, since the
ability to take account of symbolic links means the whole logic is
rather baroque, but I'd vaguely expect it either to fail or fail to
resolve the physical directory and default to trimming PWD.  (What it
does and what it should do are again not necessarily identical.)

-- 
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
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog



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