Subject: How to compute the checksum of patch files
To: None <tech-pkg@netbsd.org>
From: Roland Illig <rillig@NetBSD.org>
List: tech-pkg
Date: 12/01/2005 04:48:43
Hi all,

currently the algorithms used for calculating the checksums of patch 
files differ between pkgtools/pkglint and the rest of pkgsrc. I think 
the pkglint way is "more correct".

others:  ${SED} -e '/\$$NetBSD.*/d' $$patchfile | ${DIGEST} $$alg
pkglint: ${SED} -e '/^\$$NetBSD.*/d' $$patchfile | ${DIGEST} $$alg

For a problematic example where these checksums differ, see devel/error, 
patch-ab:

----snip----
$NetBSD: patch-ab,v 1.1 2005/06/21 21:02:16 jlam Exp $

--- strlcat.c.orig      2005-05-10 16:48:24.000000000 -0400
+++ strlcat.c
@@ -35,6 +35,7 @@ __RCSID("$NetBSD: strlcat.c,v 1.16 2003/

  size_t
  strlcat(char *dst, const char *src, size_t siz);
+#undef _DIAGASSERT
  #define _DIAGASSERT(a)

  #ifdef _LIBC
----snip----

In line 5, there is another $NetBSD keyword, so the "others" algorithm 
discards that line from the checksum. I suggest that the two places 
(bsd.pkg.mk and bsd.pkg.patch.mk) are changed to only match at the 
beginning of a line, like pkglint already does.

Roland