Subject: How to compute the checksum of patch files
To: None <>
From: Roland Illig <>
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, 

$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/

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

  #ifdef _LIBC

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