Subject: pkg/35494: ./ prefixed filenames in distinfo files break PKG_RESUME_TRANSFERS
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <rosenfeld@grumpf.hope-2000.org>
List: pkgsrc-bugs
Date: 01/26/2007 20:25:01
>Number:         35494
>Category:       pkg
>Synopsis:       ./ prefixed filenames in distinfo files break PKG_RESUME_TRANSFERS
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 26 20:25:00 +0000 2007
>Originator:     rosenfeld@grumpf.hope-2000.org
>Release:        pkgsrc-2006Q4
>Organization:
>Environment:
System: NetBSD panic 4.0_BETA2 NetBSD 4.0_BETA2 (PANIC) #1: Sun Jan 7 15:45:57 CET 2007 woodstoc@panic:/usr/obj/sys/arch/i386/compile.i386/PANIC i386
Architecture: i386
Machine: i386
>Description:
If PKG_RESUME_TRANSFERS is set, fetching distfiles for packages that
have ./ prefixed filenames in their distinfo file will only create
0-byte files but not fetch the distfiles.

This is because mk/fetch/fetch touches the distfile and then tries to
verify its checksum by running mk/checksum/checksum, which will not
recognize the distinfo entry because of the ./ prefix.

(see http://mail-index.netbsd.org/tech-pkg/2006/10/07/0002.html)
>How-To-Repeat:
set PKG_RESUME_TRANSFERS and try to fetch the distfiles for www/opera

>Fix:
Removing the ./ from the distinfo entries broke more things than it was
supposed to fix, so I guess it is better to fix mk/checksum/checksum to
strip the ./ just like mk/fetch/fetch does.


Index: mk/checksum/checksum
===================================================================
RCS file: /cvsroot/pkgsrc/mk/checksum/checksum,v
retrieving revision 1.10
diff -u -r1.10 checksum
--- mk/checksum/checksum	15 Dec 2006 13:15:06 -0000	1.10
+++ mk/checksum/checksum	26 Jan 2007 18:26:40 -0000
@@ -88,7 +88,9 @@
 # Process required arguments
 ${TEST} $# -gt 0 || { usage; exit 1; }
 distinfo="$1"; shift
-files="$@"
+for file in $@; do
+	files="$files ${file#./}"
+done
 
 if ${TEST} ! -f "$distinfo"; then
 	${ECHO} 1>&2 "$self: distinfo file missing: $distinfo"
@@ -135,6 +137,9 @@
 	eval "tmp=\"\$_alg_${d_alg}\""
 	${TEST} -n "$tmp" || eval "_alg_${d_alg}=\"$files\""
 
+	d_file="${d_file#(}"
+	d_file="(${d_file#./}"
+
 	for file in $files; do
 		sfile="${file%$suffix}"
 		${TEST} "$d_file" = "($sfile)" || continue