Subject: pkg/18422: distribute:write_index() is called too early.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <enami@sm.sony.co.jp>
List: netbsd-bugs
Date: 09/26/2002 13:03:06
>Number:         18422
>Category:       pkg
>Synopsis:       pkgsrc/mail/distribute: write_index() is called too early.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 25 21:04:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     enami tsugutomo
>Release:        NetBSD 1.6G
>Organization:
	Sony Corp.
>Environment:
System: NetBSD parity-error.sm.sony.co.jp 1.6G NetBSD 1.6G (PARITY_ERROR.UP.PROF) #315: Wed Sep 4 11:02:52 JST 2002 enami@memory-leak.sm.sony.co.jp:/a/compile/PARITY_ERROR.UP.PROF i386
Architecture: i386
Machine: i386
>Description:
	The function write_index() in distribute.c (in pkgsrc/mail/distribute)
	uses global variable `bodysum' but is called before the check sum
	is calculated.  As a result, check sum written in INDEX file is always
	zero and the program `archive' may barf as follows:

Sep 26 11:34:47 email0 archive[5067]: body checksum mismatch: incoming: 1228

>How-To-Repeat:
	UTSL is easier way.
	% make patch			# make sure patch.20.gz is applied.
	% view work.i386/distribute-pl19/distribute.c
	and see how bodysum is updated and write_index() is called.
>Fix:
	Call the write_index after the sum is calclated (but I'm not sure
	the origianl intention of the change in patch.20.gz).
>Release-Note:
>Audit-Trail:
>Unformatted: