Hello, i am facing a bug on portable OpenBSD ksh, aka oksh; where cd will attempt to search for the given directory (if not provided as an absolute path) in CDPATH before checking it in the current working directory. A way to reproduce is the following:
/tmp $ unset CDPATH /tmp $ mkdir foo /tmp $ cd foo /tmp/foo $ CDPATH=/tmp /tmp/foo $ mkdir bar /tmp/foo $ cd bar /bin/ksh: cd: bar: bad directory /tmp/foo $ unset CDPATH /tmp/foo $ cd bar /tmp/foo/bar $ This is reproducible on OpenBSD. I believe since the given directory (argument) is not an absolute path; it attempts to search in CDPATH before checking if the directory exists. This will cause any attempts to cd into a directory to fail. I also believe that the given directory to cd should be preferred over CDPATH; what i mean by this is if a directory exists within CDPATH but also exists within the current working directory; the latter should be preferred. This is my first time submitting to a mailing list, so my apologies if i get something wrong.