Subject: Re: How to compute the checksum of patch files
To: Roland Illig <rillig@netbsd.org>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-pkg
Date: 12/01/2005 11:09:02
On 12/1/05, Roland Illig <rillig@netbsd.org> wrote:
> 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.

Wouldn't it be problematic if the checksum included those lines?  In this
case, it is only a part of a complete $NetBSD$ tag, but consider a patch
that included a full tag... the checksum could be broken after each commit.

--
Julio M. Merino Vidal <jmmv84@gmail.com>
The Julipedia - http://julipedia.blogspot.com/
The NetBSD Project - http://www.NetBSD.org/