Subject: Re: How to compute the checksum of patch files
To: Roland Illig <>
From: Jeremy C. Reed <>
List: tech-pkg
Date: 12/01/2005 01:15:13
On Thu, 1 Dec 2005, Roland Illig wrote:

> 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

Maybe instead of just checking for $NetBSD at beginning of line, only 
check for that on the first line.

If $NetBSD for some reason or another was starting another line in a 
diff, someone could abuse it. Imagine in a shell script:

$NetBSD rm whatever

Maybe this doesn't matter as maybe someone couldn't add a new line to a 
diff without breaking the patch(1) use of it.

  Jeremy C. Reed

p.s. I haven't figured out yet how to do it with sed :(
I tried:
sed -e '/\$NetBSD.*/,1d'
for testing and some others but that removed all lines with $NetBSD not 
just the match on line number one.