dd(1) bug

utzoo!decvax!ittvax!swatt utzoo!decvax!ittvax!swatt
Wed Nov 25 18:33:19 AEST 1981


Wed Nov 25 18:29:27 EST 1981 (reported by swatt)
 [ ]	Bug in dd(1) "swab" routine prevents swabbing the bytes in the
	last word if the wordsize of a file is odd.  Fix is:

	-----------------------------------------------------------------
	cp /usr/src/cmd/dd.c /tmp/upd.$$.tmp ; chmod +w /tmp/upd.$$.tmp
	ed - /tmp/upd.$$.tmp <<\!xxFUNNYxx
	332c
			c = ((ibc & ~1)>>1);
	.
	1c
	static char *sccsid = "@(#)dd.c	4.2 (ITT) 11/25/81";
	.
	w
	q
	!xxFUNNYxx
	diff /usr/src/cmd/dd.c /tmp/upd.$$.tmp >/tmp/upd.$$.dif
	if cmp - /tmp/upd.$$.dif <<\!xxFUNNYxx
	1c1
	< static char *sccsid = "@(#)dd.c	4.1 (Berkeley) 10/1/80";
	---
	> static char *sccsid = "@(#)dd.c	4.2 (ITT) 11/25/81";
	332c332
	< 		c = (ibc>>1) & ~1;
	---
	> 		c = ((ibc & ~1)>>1);
	!xxFUNNYxx
	then
		: 'compare equal, ok'
		rm -f dd.c
		cp /tmp/upd.$$.tmp dd.c ; chmod a-w dd.c
	else
		echo "Old source file not same version;" \
			"use diff listings by hand"
	fi
	rm -f /tmp/upd.$$.tmp /tmp/upd.$$.dif
	-----------------------------------------------------------------
	[ /bin/dd:
		dd.c	4.1 (Berkeley) 10/1/80 ]



More information about the Comp.bugs.4bsd.ucb-fixes mailing list