bug in tar(1) compare option (FIX)

Dave Steffens das at earvax.UUCP
Thu Sep 4 04:48:56 AEST 1986


Subject: bug in tar(1) compare option (FIX)

Index: /usr/src/bin/tar.c

Description:
	The compare (C) option of tar(1) fails to correctly report
	a difference error when a file in the archive is not the same
	length as the corresponding file on the disk.

Repeat-by:
	% echo this is a test >blap
	% tar cvf flap blap
	a blap 1 blocks
	% ls -l blap
	-rw-rw-r-- 1 das      bin           15 Sep  3 14:30 blap
	% tar Cvf flap
	same rw-rw-r-- 11/3      15 Sep  3 14:30 1986 blap
	% echo add another line >>blap
	% ls -l blap
	-rw-rw-r-- 1 das      bin           32 Sep  3 14:30 blap
	% tar Cvf flap
	same rw-rw-r-- 11/3      15 Sep  3 14:30 1986 blap

Fix:
	Make the following change:
	777c777
	< 	if (fstat(ifile, &stbuf2) < 0 || bytes != stbuf.st_size)
	---
	> 	if (fstat(ifile, &stbuf2) < 0 || bytes != stbuf2.st_size)

-- 
{harvard,mit-eddie,think}!eplunix!earvax!das	David Allan Steffens
243 Charles St., Boston, MA 02114		Eaton-Peabody Laboratory
(617) 523-7900 x2748				Mass. Eye & Ear Infirmary



More information about the Comp.bugs.2bsd mailing list