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

bug with empty path



The lines:
  path=()
and
  PATH=
have different effects: the first produces an empty path array, the
second a path with one blank element.  This turns up in the following:

% cd /usr/bin
% PATH=
% ls
<listing>
% path=()
% ls
zsh: command not found: ls

which doesn't strike me as right; both should use the current
directory if there is no path.  The only `nice' way I can see of doing
it (without messing the arrays around) is handling a totally empty
path the same way as a path with a single blank element.

*** Src/exec.c.path	Mon Nov 25 15:26:47 1996
--- Src/exec.c	Mon Nov 25 15:28:12 1996
***************
*** 331,336 ****
--- 331,341 ----
  	if (isgooderr(ee, *nn ? nn : "/"))
  	    eno = ee;
      }
+     if (!*path) {
+ 	ee = zexecve(arg0, argv);
+ 	if (isgooderr(ee, ""))
+ 	    eno = ee;
+     }
      for (pp = path; *pp; pp++)
  	if (!(*pp)[0] || ((*pp)[0] == '.' && !(*pp)[1])) {
  	    ee = zexecve(arg0, argv);

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



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