Subject: error handling
To: None <agc@netbsd.org>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: tech-pkg
Date: 07/19/1999 22:38:03
Hi,
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-*"?
The patch below implements that behaviour - please let me know if i'm
missing something. Else I'd like to commit that soonish.
- Hubert
--- .#bsd.pkg.mk.1.298 Thu Jul 15 01:43:54 1999
+++ bsd.pkg.mk Mon Jul 19 22:34:22 1999
@@ -1005,12 +1005,24 @@
calcsum=`${SED} -e '/\$$NetBSD.*/d' $$i | ${MD5}`; \
recorded=`${AWK} '$$1 == "MD5" && $$2 == "('$$filename')" { print $$4; }' ${PATCH_SUM_FILE} || ${TRUE}`; \
if [ "X$$recorded" = "X" ]; then \
- ${ECHO_MSG} ">> Ignoring \"unofficial\" patch file $$i"; \
- continue; \
+ case "$$filename" in \
+ patch-local-*) \
+ ${ECHO_MSG} ">> Ignoring \"unofficial\" patch file $$i"; \
+ continue \
+ ;; \
+ *) \
+ ${ECHO_MSG} ">> Unknown patch file: $$i"; \
+ ${ECHO_MSG} ">> Please make sure that either 'make makepatchsum' was ran or"; \
+ ${ECHO_MSG} ">> check your SUP configuration for the 'delete' flag!"; \
+ exit 1; \
+ ;; \
+ esac ; \
fi; \
if [ "X$$calcsum" != "X$$recorded" ]; then \
- ${ECHO_MSG} ">> Patch file $$i has been modified - ignoring it"; \
- continue; \
+ ${ECHO_MSG} ">> Patch file $$i has been modified"; \
+ ${ECHO_MSG} ">> Please make sure that either 'make makepatchsum' was ran or"; \
+ ${ECHO_MSG} ">> check your SUP configuration for the 'delete' flag!"; \
+ exit 1; \
fi; \
fi; \
if [ ${PATCH_DEBUG_TMP} = yes ]; then \
--
NetBSD - Better for your uptime than Viagra