- Package:
- libdpkg-perl
- Source:
- libdpkg-perl
- Submitter:
- Oron Peled
- Date:
- 2026-04-11 19:07:02 UTC
- Severity:
- normal
- Tags:
Dear Maintainer,
* What led up to the situation?
- In "trixie" trying to use "Dpkg::Version::version_compare" fails
- The error was very clear:
"Use of uninitialized value $a in string at /usr/share/perl5/Dpkg/Version.pm
line 271, <> line 266."
* 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
* Alternative fix: use $a and $b directly and don't assign them from @_
* My temporary workaround: wrote a small wrapper that pass $a and $b as explicit
parameters
Hi! I assume this is meant in the context of "sort version_compare @versions". Ack. 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. 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. Thanks for the report and investigation! Regards, Guillem
Thank a lot for the quick response. 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) +1 Thank you again, (meanwhile my workaround keep stuff here ticking)
Hi! Bug #1131556 in package dpkg reported by you has been fixed in the dpkg/dpkg.git Git repository. You can see the changelog below, and you can check the diff of the fix at: https://git.dpkg.org/cgit/dpkg/dpkg.git/diff/?id=f4941036b We need prototypes for these functions so that they get the $a and $b variables automatically set by sort, otherwise they get no arguments at all. Analysis-by: Oron Peled <Oron.Peled@harmonicinc.com> Fixes: commit a9b22de4db4d42417c4cac74e7e537f48284e731 Closes: #1131556 Stable-Candidate: 1.22.x