Fix for sh PATH bug

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Fri Aug 9 21:05:08 AEST 1985


SYMPTOM:	A trailing : in $PATH or $CDPATH is not interpreted
		as meaning that a null entry (current working
		directory) follows the :

FIX:		The following is for the UNIX System V Release 2.0
		Bourne shell, including the BRL job-control version.
		Earlier Bourne shells are fixed in a similar way,
		modulo the translation into pseudo-Algol 68.

	In file "service.c", function catpath(), change:
		if (*scanp == COLON)
			scanp++;
		path = (*scanp ? scanp : 0);
	to:
		path = *scanp ? scanp + 1 : 0;	/* DAG -- bug fix */

	In the same file, function nextpath(), change:
		if (*scanp == COLON)
			scanp++;

		return(*scanp ? scanp : 0);
	to:
		return *scanp ? scanp + 1 : 0;	/* DAG -- bug fix */

NOTE:		The resulting executable is also 12 bytes smaller
		(VAX version).



More information about the Net.bugs.usg mailing list