Subject: Re: muhah
To: Jason R Thorpe , Bill Studenmund <wrstuden@zembu.com>
From: Alistair Crooks <agc@pkgsrc.org>
List: tech-pkg
Date: 03/27/2001 10:51:21
On Mon, Mar 26, 2001 at 01:41:30PM -0800, Jason R Thorpe wrote:
> On Mon, Mar 26, 2001 at 06:22:06PM +0100, Alistair Crooks wrote:
> 
>  > Because there were/are about 3000 files in pkgsrc which have
>  > information stored in the output format of md5(1) - all of the
>  > files/md5 and files/patch-sum files.  I made the output of digest(1)
>  > compatible with that, so that I wouldn't have to add yet more logic to
>  > bsd.pkg.mk to work out whether I was dealing with an md5-style
>  > checksum, or an openssl-style checksum.
> 
> How tough would it be to:
> 
> 	(1) Change the output of OpenSSL's hashing sub-programs
> 	    to match our (somewhat nicer) output, or
> 
> 	(2) Change bsd.pkg.mk to understand both.

For (2) above, the logic in bsd.pkg.mk to calculate the checksum on a
distfile fetched with FAILOVER_FETCH set is as follows:

                                if [ -n "${FAILOVER_FETCH}" -a -f ${DIGEST_FILE} -a -f ${_DISTDIR}/$$bfile ]; then \
                                        alg=`${AWK} 'NF == 4 && $$2 == "('$$file')" && $$3 == "=" {print $$1;}' ${DIGEST_FILE}`; \
                                        if [ -z "$$alg" ]; then         \
                                                alg=${DIGEST_ALGORITHM};\
                                        fi;                             \
                                        CKSUM=`${DIGEST} $$alg < ${_DISTDIR}/$$bfile`; \
                                        CKSUM2=`${AWK} '$$1 == "'$$alg'" && $$2 == "('$$file')" {print $$4;}' <${DIGEST_FILE}`; \
                                        if [ "$$CKSUM" = "$$CKSUM2" -o "$$CKSUM2" = "IGNORE" ]; then \
                                                continue 2;             \
                                        else                            \
                                                ${ECHO_MSG} "=> Checksum failure - trying next site."; \
                                        fi;                             \

Once again, I'll reiterate - it's not a biggy, but there are another 2
places where this calculation is done, and 2 where the files/md5 and
files/patch-sum files are generated.

(a) And, once again, I'll reiterate - WTF would I want to do this?

(b) We gain, duh, what exactly?

(c) We add extra logic in there for, duh, what reason exactly?

I'll let the openssl champion have his say for (1), and would
encourage him to answer questions (a), (b) and (c) above.

Regards,
Alistair