Index | Thread | Search

From:
Andrew Hewus Fresh <andrew@afresh1.com>
Subject:
Re: pkg_create: @lib without LIBname_VERSION
To:
Stuart Henderson <stu@spacehopper.org>, George Koehler <kernigh@gmail.com>, ports@openbsd.org
Date:
Sat, 15 Nov 2025 20:21:28 -0800

Download raw body.

Thread
On Wed, Nov 12, 2025 at 01:24:34PM +0100, Marc Espie wrote:
> On Wed, Nov 12, 2025 at 10:55:16AM +0000, Stuart Henderson wrote:
> > I'd appreciate leaving the python libname craziness as-is until 3.13 is in :)
> 
> And so, once python 3.13 is in (hopefully soon !!!)
> 
> 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.
> 
> Thus fixing libtalloc.
> 
> Index: OpenBSD/PkgCreate.pm
> ===================================================================
> RCS file: /vide/cvs/src/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm,v
> diff -u -p -r1.167 PkgCreate.pm
> --- OpenBSD/PkgCreate.pm	26 Jan 2020 12:50:17 -0000	1.167
> +++ OpenBSD/PkgCreate.pm	12 Nov 2025 12:22:30 -0000
> @@ -792,15 +792,19 @@ package OpenBSD::PackingElement::Lib;
>  sub check_version
>  {
>  	my ($self, $state, $unsubst) = @_;
> -	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?

https://github.com/openbsd/src/blob/master/usr.sbin/pkg_add/OpenBSD/PackingElement.pm#L662

I didn't quite follow how an element gets blessed into a :Lib so I might
have misunderstood something.

It probably doesn't matter because it will `$state->error` if it's
undef, but seems like `$state->{has_libraries}` should be inside the `if
defined`.

Other than that, looking forward to python 3.13 so we can get perl 5.42 :-)


> -		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;
> @@ -1253,7 +1257,7 @@ sub read_fragments
>  	# 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);
>  				}
>  			}
>