[net.bugs.4bsd] arguments to adb :r command are damaged

mogul@Coyote (Jeff Mogul) (04/19/84)

Description:
	Arguments after the first supplied to the :r command of ADB
	have their first character dropped.
	
	(Original bug report by cmcl2!rna!dan, 30 Jan 84.)
Repeat-By:
	% adb /bin/echo
	:r abc def ghi

	should print: abc def ghi
	actually prints: abc ef hi
Fix:
	The bug is in doexec() in runpcs.c.  The body of the
	major loop is:
		throws away spaces
		copy an argument
		throws away spaces
	the problem being that the two different sets of code for
	throwing away spaces are incompatible in such a way as to
	discard one extra character each time.  My fix is to
	move some code out of the loop; by turning the do loop
	into a while loop one could get rid of a redundant test
	but I didn't bother.
	
	The same bug seems to lurk in the 4.1BSD version of adb;
	probably the same fix would work.

*** runpcs.c.old	Thu Aug 11 20:06:55 1983
--- runpcs.c	Thu Apr 19 01:55:10 1984
***************
*** 171,173
  	*ap++=symfil;
! 	REP	IF rdc()==EOR THEN break; FI
  		*ap = p;

--- 171,174 -----
  	*ap++=symfil;
! 	rdc();
! 	REP	IF lastc==EOR THEN break; FI
  		*ap = p;

salkind@cmcl2.UUCP (04/20/84)

To give credit where it is due, rws@mit-bold reported the bug and fix
on November 18 in unix-wizards.

It is a shame that people keep rediscovering the same old bugs all over
again.  What ever happend to the Mt. Xinu plan of rebroadcasting bug
reports?

	Lou