From: George Koehler Subject: Re: pkg_create: @lib without LIBname_VERSION To: Marc Espie , Andrew Hewus Fresh Cc: Stuart Henderson , ports@openbsd.org Date: Tue, 18 Nov 2025 20:59:14 -0500 On Wed, 12 Nov 2025 13:24:34 +0100 Marc Espie wrote: > This does take care of actually matching the libname against the actual > substituted variables, simply by matching the unsubst value against the > pattern we want, and just doing a substitute on that to expand any > variables we may need. I like your patch, but you forgot to cvs up the src tree. At the bottom of this mail is your patch applied to my tree. A moment ago, I found that this patch breaks security/qtkeychain, x11/gnustep/highlighterkit, x11/gnustep/projectcenter. $ make -C security/keychain print-plist-all >/dev/null Error: Incorrectly versioned shared library: @lib lib/lib${LIBNAME_L}.so.${LIB${LIBNAME_L}_VERSION} These ports have more than one '${LIB' and the regexp is matching the wrong one. I guess that we need to count braces. On Sat, 15 Nov 2025 20:21:28 -0800 Andrew Hewus Fresh wrote: > > - my @l = $self->parse($self->name); > > + $state->{has_libraries} = 1; > > + my @l = $self->parse($self->name); > > if (defined $l[0]) { > > Did I misunderstand that only if `$l[0]` is defined then this element is > a lib? This part looks correct to me: $self is always a @lib; $l[0] is defined if and only if the filename fits "lib$name.so.$major.$minor". --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 17 Nov 2025 23:08:50 -0000 @@ -769,17 +769,20 @@ sub id($self) package OpenBSD::PackingElement::Lib; sub check_version($self, $state, $unsubst) { - my @l = $self->parse($self->name); + $state->{has_libraries} = 1; + my @l = $self->parse($self->name); if (defined $l[0]) { - if (!$unsubst =~ m/\$\{LIB$l[0]_VERSION\}/) { - $state->error( - "Incorrectly versioned shared library: #1", - $unsubst); + if ($unsubst =~ m/\$\{LIB(.*?)\_VERSION\}$/) { + my $name = $state->{subst}->do($1); + if ($name eq $l[0]) { + return; + } } + $state->error("Incorrectly versioned shared library: #1", + $unsubst); } else { $state->error("Invalid shared library #1", $unsubst); } - $state->{has_libraries} = 1; } package OpenBSD::PackingElement::DigitalSignature; @@ -1205,7 +1208,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); } }