NetBSD Problem Report #57928

From  Sun Feb 11 21:25:27 2024
Return-Path: <>
Received: from ( [])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id E2A731A9238
	for <>; Sun, 11 Feb 2024 21:25:26 +0000 (UTC)
Message-Id: <>
Date: Sun, 11 Feb 2024 21:25:25 +0000 (UTC)
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
The Pkgsrc Licensation
From <>:

> 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/

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/ 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/ 1.288 (from 2008-10-05) set `ACCEPTABLE_LICENSES?= ${DEFAULT_ACCEPTABLE_LICENSES}', and mk/ 1.12 (from 2009-04-08) used `!empty(ACCEPTABLE_LICENSES:M${LICENSE})' to check for a match.
2. joerg adapted mk/ to use `pkg_admin check-license' in order to evaluate logical license expressions with AND and OR, in mk/ 1.24 (2009-06-14), passing both ACCEPTABLE_LICENSES _and_ DEFAULT_ACCEPTABLE_LICENSES through environment variables.

Expected result: no

Actual result: yes

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:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.