Index | Thread | Search

From:
George Koehler <kernigh@gmail.com>
Subject:
pkg_create: @lib without LIBname_VERSION
To:
ports@openbsd.org
Cc:
marc.espie.openbsd@gmail.com, andrew@afresh1.com
Date:
Fri, 7 Nov 2025 22:52:05 -0500

Download raw body.

Thread
pkg_create has some code to check every @lib in a PLIST is correctly
versioned (by expanding ${LIBname_VERSION}).  This check is broken, so
the error never happens.  The broken code will cause a warning in
Perl 5.42, so we must change it before we update Perl.

When I fixed the check, it broke a few ports,

$ make -C lang/vala print-plist-all >/dev/null                        
Error: Incorrectly versioned shared library: \
@lib lib/libvala-${API_V}.so.${LIBvala-${API_V}_VERSION}

This @lib line is correct, but pkg_create looked for the exact string
'${LIBvala-0.56_VERSION}' in the unsubstituted line, and didn't find
it, because API_V=0.56 was unsubst.  There are more than 30 ports like
this; see list below diff.  (Because print-plist-all can produce the
error, I didn't need a bulk build to find the broken ports.)

I want to commit this version of the diff, which has '0 &&' to disable
the check, so ports like lang/vala don't break.  The other changes in
this diff are,
 - Change "!$x =~ m/y/" to "$x !~ m/y/", which fixes the Perl 5.42
   warning "Possible precendence problem between ! and =~".
 - Add \Q and \E to the regexp, so libestdc++ stops matching
   '${LIBestdcccccc_VERSION}'.
 - Pass the unsubstituted string to check_version: the caller did
   "my $s = $subst->do($l);", so pass $l, not $s.

In the future, we might modify and enable this check.  For example, we
might compare libvala's filename's version with LIBvala-0.56_VERSION,
without looking for '${LIBvala-0.56_VERSION}'.  This might work for
devel/libtalloc,-python which has,

@lib lib/libpytalloc-util.${PYTALLOC_UTIL_LIBSUFFIX}

We can't enable a check now, because cad/qcad has lines like,

@lib share/qcad/plugins/script/libqtscript_core.so.1.0

There is no LIBqtscript_core_VERSION=1.0; and I'm not sure whether to
add these plugins to SHARED_LIBS or change them from @lib to @so.

Is this diff with '0 &&' ok?
--gkoehler

Index: OpenBSD/PkgCreate.pm
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm,v
diff -u -p -r1.200 PkgCreate.pm
--- OpenBSD/PkgCreate.pm	15 Sep 2025 01:59:37 -0000	1.200
+++ OpenBSD/PkgCreate.pm	7 Nov 2025 00:34:11 -0000
@@ -771,7 +771,8 @@ sub check_version($self, $state, $unsubs
 {
 	my @l  = $self->parse($self->name);
 	if (defined $l[0]) {
-		if (!$unsubst =~ m/\$\{LIB$l[0]_VERSION\}/) {
+		# Skip next check; ${LIBvala-${API_V}_VERSION} broke it.
+		if (0 && $unsubst !~ m/\$\{LIB\Q$l[0]\E_VERSION\}/) {
 			$state->error(
 			    "Incorrectly versioned shared library: #1", 
 			    $unsubst);
@@ -1205,7 +1206,7 @@ sub read_fragments($self, $state, $plist
 	# XXX some things, like @comment no checksum, don't produce an object
 				my $o = &$cont($s);
 				if (defined $o) {
-					$o->check_version($state, $s);
+					$o->check_version($state, $l);
 					$self->annotate($o, $l, $file);
 				}
 			}

Removing the '0 &&' would break these ports:
cad/qcad
databases/tdbc
devel/goffice
devel/libsigc++-2
devel/libsoup
devel/libsoup3
devel/libtalloc
devel/py-gobject
devel/spidermonkey128
editors/qscintilla
games/love/0.10
games/love/11
geo/champlain
graphics/babl
graphics/clutter/core
graphics/clutter/clutter-gtk
graphics/gegl04
lang/guile2
lang/guile3
lang/luajit
lang/vala
multimedia/gstreamer1/core
multimedia/gstreamer1/devtools
multimedia/gstreamer1/editing-services
multimedia/gstreamer1/mm
multimedia/gstreamer1/plugins-base
multimedia/gstreamer1/plugins-bad
multimedia/gstreamer1/rtsp-server
security/qtkeychain
textproc/tdom
wayland/wlroots
www/webkitgtk4
x11/gnome/grilo
x11/gtksourceview3
x11/libhandy
x11/qt6/pyside6/pyside
x11/qt6/pyside6/shiboken