On Sun, 2026-03-22 at 20:46 +0100, Guillem Jover wrote:
> Hi!
> 
> On Sun, 2026-03-22 at 16:13:28 +0000, Oron Peled wrote:
> > Package: libdpkg-perl
> > Version: 1.22.22
> > Severity: normal
> 
> > * What led up to the situation?
> >   - In "trixie" trying to use "Dpkg::Version::version_compare" fails
> 
> I assume this is meant in the context of "sort version_compare @versions".
> 
> >   - The error was very clear:
> >     "Use of uninitialized value $a in string at 
> > /usr/share/perl5/Dpkg/Version.pm
> > line 271, <> line 266."
> 
> Ack.

Thank a lot for the quick response.

> > * The root cause is in commit (appeared before version 1.22.12):
> >   "a9b22de4db4d42417c4cac74e7e537f48284e731 perl: Remove function 
> > prototypes"
> > 
> > * Removing prototype of a sort function affects its semantics.
> >   From "sort" documentation in perlfunc man page:
> >       "If the subroutine's prototype is "($$)", the elements to be compared
> >        are passed by reference in @_, as for a normal subroutine."
> > 
> > * But the existing code still expect parameters in @_
> >   (which is empty after prototype removal)
> > 
> > * Minimal fix: re-add the missing prototype to that function
> 
> I've done this (using the signatures syntax so that the code can then
> still be switched to use full sub signatures), with the attached change,
> and included a matching change for Dpkg::Deps, where I noticed that it
> always had that same problem (so not a regression). I'll add some unit
> tests and queue these for the next dpkg upload (1.23.x), and I'll mark
> the Dpkg::Version change for a stable update (1.22.x) fix.

The stable update is really useful
(as most of our build infrastructure already migrated to "trixie" but will stay
they in the next 1.5 years)

> > * Alternative fix: use $a and $b directly and don't assign them from @_
> 
> This would mean you cannot call this with parameters, which would
> break way more code I think (at least from within dpkg itself), and
> turns into a way more surprising API.

+1

> > * My temporary workaround: wrote a small wrapper that pass $a and $b as 
> > explicit
> > parameters
> 
> Thanks for the report and investigation!

Thank you again,
(meanwhile my workaround keep stuff here ticking)

> Regards,
> Guillem

--
Oron Peled

Reply via email to