[net.unix-wizards] 4.2/sysV difference

mts@cosivax.UUCP (Michael Stolarchuk) (01/13/86)

I was recently debugging a routine using "execvp".  The bug was actually
a difference between system V and 4.2.  I don't understand the difference,
and hope someone in the field can explain to me why the two systems do the
"execvp" differently.

On 4.2 systems the environment variable "PATH" used by "execvp"
to locate the directories to scan.  The path elements (directories)
are separated by ':'.  They can also be separated by '-'.

If path=(/bin /usr/bin /usr/local ... /usr/new test-test), and 
executable file in test-test, even when csh finds the executable,
a small test program doing execvp for the file doens't find it.

It makes sense to me there is a reason for the termination of the
element by '-', but I can't figure out what the reason is.

--------------------
Empty-S, in Michigan.
--------------------

guy@sun.uucp (Guy Harris) (01/16/86)

> I was recently debugging a routine using "execvp".  The bug was actually
> On 4.2 systems the environment variable "PATH" used by "execvp"
> to locate the directories to scan.  The path elements (directories)
> are separated by ':'.  They can also be separated by '-'.
> 
> If path=(/bin /usr/bin /usr/local ... /usr/new test-test), and 
> executable file in test-test, even when csh finds the executable,
> a small test program doing execvp for the file doens't find it.
> 
> It makes sense to me there is a reason for the termination of the
> element by '-', but I can't figure out what the reason is.

The reason is that at some point in UNIX's history (at AT&T, I presume), it
was considered a feature that path elements could be separated by '-'.  This
was later changed, but the change didn't propagate instantaneously to all
places where PATH variables were scanned.  As such, any systems which still
recognize '-' as a path separator have a bug.  It was, conceivably, not
fixed in UNIX/32V, which is what 4.xBSD is derived from.  It is *STILL* not
fixed in the System V, Release 2, VAX Version1 "make"!  (Fix: get rid of the
"*s1 != MINUS" clause in the first "while" loop in "execat" in "misc.c."  It
is, however, fixed in the 4.3BSD "execvp".

	Guy Harris