NetBSD Problem Report #61088

From dholland@netbsd.org  Sun Nov 29 10:19:53 2026
Return-Path: <dholland@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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0E72D1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 29 Nov 2026 10:19:53 +0000 (UTC)
Message-Id: <20261129101952.8ABB784F19@mail.netbsd.org>
Date: Sun, 29 Nov 2026 10:19:52 +0000 (UTC)
From: dholland@NetBSD.org
Reply-To: dholland@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: pkg_alternatives filter.conf does not work as documented
X-Send-Pr-Version: 3.95
X-From4GNATS: "dholland@NetBSD.org via gnats" <gnats-admin@NetBSD.org>

>Number:         61088
>Category:       pkg
>Synopsis:       pkg_alternatives filter.conf does not work as documented
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 29 10:20:00 +0000 2026
>Originator:     David A. Holland
>Release:        pkgsrc of 20261129
>Organization:
necessary dorsal muscles
>Environment:
System: NetBSD valkyrie 11.99.4 NetBSD 11.99.4 (VALKYRIE2) #0: Thu Jan  1 22:38:54 EST 2026  dholland@valkyrie:/usr/src/sys/arch/amd64/compile/VALKYRIE2 amd64
Architecture: x86_64
Machine: amd64
>Description:

pkg_alternatives(8) documents that you can add regexp patterns to a
file etc/pkg_alternatives/filter.conf to control which alternatives
wrappers it creates. Owing to inadequate shell quoting, this does not
work if your regexp contains characters interpreted by the shell.

>How-To-Repeat:

Put "ignore .*" in /usr/pkg/etc/pkg_alternatives/filter.conf, run
pkg_alternatives rebuild, watch it install all the wrappers anyway.

>Fix:

Will commit, just want someone to confirm that I'm not missing
something.

Index: files/pkg_alternatives.sh
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_alternatives/files/pkg_alternatives.sh,v
retrieving revision 1.7
diff -u -r1.7 pkg_alternatives.sh
--- files/pkg_alternatives.sh	13 Jun 2012 15:35:32 -0000	1.7
+++ files/pkg_alternatives.sh	29 Nov 2026 10:12:50 -0000
@@ -442,14 +442,14 @@
         what=${f%%__dE/lImIt/Er__*}
         case ${what} in
             accept)
-                name=$(echo ${f#*__dE/lImIt/Er__} | sed -e 's#__dE/lImIt/Er__# #g')
+                name=$(echo "${f#*__dE/lImIt/Er__}" | sed -e 's#__dE/lImIt/Er__# #g')
                 if echo ${1} | grep "${name}" >/dev/null; then
                     info "filter accepts \`${1}'"
                     return 0
                 fi
                 ;;
             ignore)
-                name=$(echo ${f#*__dE/lImIt/Er__} | sed -e 's#__dE/lImIt/Er__# #g')
+                name=$(echo "${f#*__dE/lImIt/Er__}" | sed -e 's#__dE/lImIt/Er__# #g')
                 if echo ${1} | grep "${name}" >/dev/null; then
                     info "filter ignores \`${1}'"
                     return 1

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.