NetBSD Problem Report #57928

From www@netbsd.org  Sun Feb 11 21:25:27 2024
Return-Path: <www@netbsd.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))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E2A731A9238
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 11 Feb 2024 21:25:26 +0000 (UTC)
Message-Id: <20240211212525.37F851A9239@mollari.NetBSD.org>
Date: Sun, 11 Feb 2024 21:25:25 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: pkgsrc guide on overriding ACCEPTABLE_LICENSES is broken
X-Send-Pr-Version: www-1.0

>Number:         57928
>Category:       pkg
>Synopsis:       pkgsrc guide on overriding ACCEPTABLE_LICENSES is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 11 21:30:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The Pkgsrc Licensation
>Environment:
>Description:
From <https://www.NetBSD.org/docs/pkgsrc/pkgsrc.html#handling-licenses>:

> One might want to only install packages with a BSD license, or the GPL, and not the other. The free licenses are added to the default ACCEPTABLE_LICENSES variable. The pkgsrc user can override the default by setting the ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file pkgsrc/mk/license.mk.

However, this doesn't work: pkgsrc happily builds packages when ACCEPTABLE_LICENSES is set to empty in mk.conf.

It doesn't work to set DEFAULT_ACCEPTABLE_LICENSES in mk.conf either, because mk/license.mk unconditionally sets DEFAULT_ACCEPTABLE_LICENSES.

It doesn't work to set ACCEPTABLE_LICENSES= (empty) and DEFAULT_ACCEPTABLE_LICENSES= (empty) in pkg_install.conf either, because pkgsrc sets the environment variable PKGSRC_DEFAULT_ACCEPTABLE_LICENSES unconditionally to the default list, and pkg_install adds whatever is in that environment variable to the acceptable list.

Embarrassingly enough, the discrepancy appears to have been there since 2009:

1. On 2009-04-08, wiz added text in doc/guide/files/fixes.xml 1.98 about using `=' instead of `+=' with ACCEPTABLE_LICENSES in order to override the default.  At the time, this was correct: mk/bsd.prefs.mk 1.288 (from 2008-10-05) set `ACCEPTABLE_LICENSES?= ${DEFAULT_ACCEPTABLE_LICENSES}', and mk/license.mk 1.12 (from 2009-04-08) used `!empty(ACCEPTABLE_LICENSES:M${LICENSE})' to check for a match.
2. joerg adapted mk/license.mk to use `pkg_admin check-license' in order to evaluate logical license expressions with AND and OR, in mk/license.mk 1.24 (2009-06-14), passing both ACCEPTABLE_LICENSES _and_ DEFAULT_ACCEPTABLE_LICENSES through environment variables.
>How-To-Repeat:
cd net/socat && make show-var VARNAME=_ACCEPTABLE_LICENSE ACCEPTABLE_LICENSES=

Expected result: no

Actual result: yes


>Fix:
Yes, please!

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.