NetBSD Problem Report #60967

From zakinko@snowrabbit.org  Fri Nov  6 01:00:03 2026
Return-Path: <zakinko@snowrabbit.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A70BE1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  6 Nov 2026 01:00:03 +0000 (UTC)
Message-Id: <20261106010000.730C2C92F3@bambi.snowrabbit.org>
Date: Fri,  6 Nov 2026 10:00:00 +0900 (JST)
From: zakinko@snowrabbit.org
Reply-To: zakinko@snowrabbit.org
To: gnats-bugs@NetBSD.org
Cc: zakinko@snowrabbit.org
Subject: pkgsrc: make makepatchsum on a fresh pkgsrc writes a broken distinfo
X-Send-Pr-Version: 3.95
X-From4GNATS: "zakinko@snowrabbit.org via gnats" <gnats-admin@NetBSD.org>

>Number:         60967
>Category:       pkg
>Synopsis:       pkgsrc: make makepatchsum on a fresh pkgsrc writes a broken distinfo
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 06 01:05:00 +0000 2026
>Originator:     Showta Ishizaki
>Release:        pkgsrc as of 2026-11-06, mk/checksum/bsd.checksum.mk 1.12
>Organization:
>Environment:
System: NetBSD 11.0 amd64, FreeBSD 14.4-RELEASE amd64
>Description:
	First, I am sorry about pkg/60796.  I sent it with only an
	artificial reproduction and without what had actually happened,
	and I had not found the cause.  Closing it was right.  I have now
	tracked the cause down, so I am reporting it again properly.

	What happened: in CI, on a fresh FreeBSD 14.4 VM (pkgsrc
	bootstrapped) and on fresh NetBSD 11.0 VMs (base tools), I edited
	a patch in security/polkit and ran make makepatchsum.  It
	returned 0, but every patch line in distinfo came out chained:

	  SHA1 (patch-src_polkit_polkitunixprocess.c) = SHA1 (patch-src_programs_pkttyagent.c) = d9044bcc...

	  https://github.com/zakinko/pkgsrc-zakinko/actions/runs/35798846904
	  https://github.com/zakinko/pkgsrc-zakinko/actions/runs/35799000991
	  https://github.com/zakinko/pkgsrc-zakinko/actions/runs/35810733331

	The same step worked on my own machine, because digest was already
	installed there.

	Neither bootstrap nor NetBSD base provides digest.
	bsd.checksum-vars.mk and bsd.patch-vars.mk add digest:bootstrap to
	USE_TOOLS, and bootstrap-depends installs it.  distinfo and makesum
	get there through fetch, but makepatchsum depends on nothing, so
	on a tree where nothing has been built yet it calls ${TOOLS_DIGEST}
	before it exists:

	  sh: /usr/pkg/bin/digest: not found

	distinfo.awk does not notice, and writes the chained lines above.
	Editing a patch is not needed for this; make makepatchsum alone
	does it on a fresh tree.

>How-To-Repeat:
	On a fresh pkgsrc where nothing has been built yet:

	  cd devel/libffi
	  make makepatchsum
	  grep -c '= SHA1 (' distinfo

	On NetBSD 11.0 and FreeBSD 14.4 with pkgsrc-current of 2026-11-05,
	this printed "digest: not found" 13 times, returned 0, and the
	grep counted 13.  make distinfo and make makesum on the same trees
	installed digest and left distinfo as it was.

>Fix:
	The diff below makes makepatchsum depend on bootstrap-depends.  It
	does not use the distfiles, so fetch did not look necessary.

	With it, on the same trees, make makepatchsum installed digest
	first and left distinfo identical to the tree's.  With one patch
	edited, only that patch's line changed, and its hash matches digest
	sha1 of the patch with its $NetBSD$ line removed.  make distinfo
	and make makesum gave the same result as before.  The log of all
	of this is here:

	  https://github.com/zakinko/pkgsrc-zakinko/actions/runs/41975009766

	makepatchsum now also goes through what bootstrap-depends carries,
	such as the can-be-built-here check, as fetch does.

	Thank you for looking at pkg/60796, and sorry again for the
	trouble it caused.

	Diff against pkgsrc-current of 2026-11-06:

	--- mk/checksum/bsd.checksum.mk.orig
	+++ mk/checksum/bsd.checksum.mk
	@@ -46,6 +46,7 @@
	 .PHONY: makesum makepatchsum mps mdi makedistinfo distinfo

	 checksum checksum-phase distinfo makesum: fetch
	+makepatchsum: bootstrap-depends
	 makedistinfo mdi: distinfo
	 mps: makepatchsum

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.