Subject: Re: error handling
To: None <hubertf@netbsd.org>
From: Alistair G. Crooks <agc@ftp.netbsd.org>
List: tech-pkg
Date: 07/26/1999 03:32:19
[The bad thing about vacations is that you have to come back from them.]

> I've just been bitten again by a out-of-date files/patch-sum file, and I
> wonder if we're doing error handling correctly here:
> 
> (bsd.pkg.mk V1.299, lines 1015+):
> 	if [ "X$$recorded" = "X" ]; then \
> 		${ECHO_MSG} ">> Ignoring \"unofficial\" patch file $$i"; \
> 		continue;	\
> 	fi;			\
> 	if [ "X$$calcsum" != "X$$recorded" ]; then \
> 		${ECHO_MSG} ">> Patch file $$i has been modified - ignoring it"; \
> 		continue;	\
> 	fi;			\
> 
> Shouldn't we just bomb out ("exit 1") instead of "continue" here, telling
> the user that there's something broken? At least for files that haven
> wrong checksums or aren't of the form "patch-local-*"?

I don't think so. The patch-sum checking was introduced as a way
of applying only known-good patches to an extracted package, mainly
as a way of using tar to extract a new pkgsrc.tar.gz over an existing
pkgsrc tree.

I really don't want to "bomb out" if there are other files there. I
suppose there's a case to be made for an "EXIT_IF_PATCH_SUM_MISMATCHES"
variable, but, to me, that's way over the top:

The "out-of-date"files/patch-sum file will only hurt people who
are constructing packages, i.e. NetBSD developers, or people who
are mucking about with a package's internals.  I'm prepared to bet
that the vast majority of people who use packages do not fall into
that category (and I include myself here, because I am a major user
of packages).

There's an argument to be made for making the error message a lot
more visible, which is what I'd like to make happen now.

> The patch below implements that behaviour - please let me know if i'm
> missing something. Else I'd like to commit that soonish.

So, in short, please do not commit this change.

Thanks,
Alistair