Subject: Re: Strange 1.6.2 problem
To: John Klos <john@ziaspace.com>
From: Alistair Crooks <agc@pkgsrc.org>
List: tech-pkg
Date: 02/28/2005 11:26:12
On Sun, Feb 27, 2005 at 01:43:37PM -0800, John Klos wrote:
> >The output you pasted was this:
> >
> >>221-Goodbye. You uploaded 0 and downloaded 821 kbytes.
> >>221 Logout.
> >>+ [ -n yes -a -f /usr/pkgsrc/misc/screen/distinfo -a -f
> >>/usr/pkgsrc/distfiles//screen-4.0.2.tar.gz ]
> >>+ /usr/bin/awk NF == 4 && $2 == "(screen-4.0.2.tar.gz)" && $3 == "="
> >>{print $1;} /usr/pkgsrc/misc/screen/distinfo
> >>+ alg=SHA1
> >>RMD160
> >>+ [ -z SHA1
> >>RMD160 ]
> >>+ /usr/local/bin/digest SHA1 RMD160
> >>RMD160
> >>+ CKSUM=
> >>*** Error code 1
> >
> >and if you look in bsd.pkg.mk for the "checksum" target, you'll see that
> >the awk command in 1.1595 is as follows:
> >
> >CKSUM2=`${AWK} 'NF == 4 && $$1 == "'$$a'" && $$2 == "('$$file')" && $$3 == 
> >"=" {print $$4;}' ${DISTINFO_FILE}`; \
> >
> >and in 1.1593 and before it was
> >
> >alg=`${AWK} 'NF == 4 && $$2 == "('$$file')" && $$3 == "=" {print $$1;}' 
> >${DISTINFO_FILE}`; \
> >
> >so which version of bsd.pkg.mk do you think you were using?
> 
> 1.1595. The alg line that you say was in 1.1593 is also in the fetch 
> macro, which is where it was getting called.

Ah, my apologies, you are right. I have been concentrating on the invocation
in the checksum target, and not in the failover fetch case.
 
> Now that you've pointed that out, I've tried the first line in the fetch 
> macro, and it works fine. Should I commit that?

Well, thinking about it, I think the failover fetch case should
terminate attempts to download when it finds a distfile which matches
at least one of the recorded digests, not necessarily all, and leave
the full work of checking distfile integrity to the checksum target. 
So I think we should just pick one digest from the distinfo file.

Perhaps something like this (untested) might work?

onesum=`${AWK} 'NF == 4 && $$1 == "${PATCH_DIGEST_ALGORITHM}" && $$2 == "('$$file')" && $$3 == "=" {print $$4;}' ${DISTINFO_FILE}`; \

Sorry about that,
Alistair