[comp.unix.shell] ksh's cd tries to do too much

chrisb@risky.Convergent.COM (Chris Bertin) (03/22/91)

Ksh does some pre-parsing on the argument to 'cd'. It removes from the
argument all the '..' and the name before the '..' (for optimization, I
guess):

	cd _not_a_directory/../_junk_/..

has no effect, even though 2 directories in the argument don't exist. The
problem is that if you type:

	cd _valid_CDPATH_directory/..

it has no effect either and I think that's a bug.

	$ echo $CDPATH
	:/a/b/c
	$ cd /a/b/c/d
	$ pwd
	/a/b/c/d
	$ cd /
	$ ls d
	d: No such file or directory
	$ cd d/..
	$ pwd
	/

This works with /bin/sh (the shell would put me in /a/b/c) and I didn't find
anything in the man page that would mention this as a 'feature'.

Chris

-- 
Chris Bertin		|   chrisb@risky.Convergent.COM
Unisys			|		or
(408) 435-3762		| ...!uunet!pyramid!ctnews!risky!chrisb

lvc@cbnews.att.com (lawrence.v.cipriani) (03/22/91)

In article <3604@risky.Convergent.COM> chrisb@risky.Convergent.COM (Chris Bertin) writes:
>Ksh does some pre-parsing on the argument to 'cd'. It removes from the
>argument all the '..' and the name before the '..' (for optimization, I
>guess):

What version of ksh are you running?  This was removed; it is not present
in ksh88f:

	$ cd
	$ mkdir -p $HOME/x/y
	$ CDPATH=:$HOME/x
	$ cd y/..
	$ pwd
	/usr6/lvc/x

Ksh will do a CDPATH search even if there are /'s in the path given to cd
and it will not do any sort of pre-parsing now.
-- 
Larry Cipriani, att!cbvox!lvc or lvc@cbvox.att.com
"Fight fire with fire, I always say" -- Bugs Bunny

chrisb@risky.Convergent.COM (Chris Bertin) (03/26/91)

In article <1991Mar22.151308.8705@cbnews.att.com> lvc@cbnews.att.com (lawrence.v.cipriani) writes:
>
>What version of ksh are you running?  This was removed; it is not present
>in ksh88f:
>
>-- 
>Larry Cipriani, att!cbvox!lvc or lvc@cbvox.att.com
>"Fight fire with fire, I always say" -- Bugs Bunny

I am running 88e (the version that came with our SVR4 tape). I got a message
from David Korn telling me that it was fixed in 88f.

-- 
Chris Bertin		|   chrisb@risky.Convergent.COM
Unisys			|		or
(408) 435-3762		| ...!uunet!pyramid!ctnews!risky!chrisb