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

Small problem with CDPATH processing in 3.1.0



I noticed a problem with CDPATH in zsh 3.0.1, and have verified that it is
still a problem in zsh 3.1.0 that I just fetched from ftp.ips.oz.au.

If you are in directory "/a" and "/a/b" exists and CDPATH=".:/foo" then
"cd b" works and does not print the new path.  If "/foo/c" exists then
"cd c" works and prints the new path "/foo/c".

If CDPATH=":/foo" this should work the same, but it does not.  Instead,
"cd b" "/a/b" to be printed.  Following is a suggested patch to zsh 3.1.0
to fix this.  It should apply to earlier versions also.

By the way, CDPATH="/foo" also works, but will not be well received by
/bin/sh (at least under Solaris).  It seems foolish for zsh to differ in this
way from /bin/sh and it caused me a little trouble with failing shell scripts
before I tracked it down.

Please note that I have not joined the list, so if you want me to see any
replies, you will have to mail me directly.

*** builtin.c.dist	Sat Dec 21 11:22:26 1996
--- builtin.c	Fri Jan 17 17:31:49 1997
***************
*** 1159,1165 ****
      if (!nocdpath)
  	for (pp = cdpath; *pp; pp++) {
  	    if ((ret = cd_try_chdir(*pp, dest))) {
! 		if (strcmp(*pp, ".")) {
  		    doprintdir++;
  		}
  		return ret;
--- 1159,1165 ----
      if (!nocdpath)
  	for (pp = cdpath; *pp; pp++) {
  	    if ((ret = cd_try_chdir(*pp, dest))) {
! 		if (**pp && strcmp(*pp, ".")) {
  		    doprintdir++;
  		}
  		return ret;


Cheers,

Stephen.



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