The default bug view has changed. See this FAQ.

version.pm 0.92 and newer forbids negative values, making checksetup.pl fail with the error "Invalid version format"

RESOLVED FIXED in Bugzilla 4.0

Status

()

Bugzilla
Installation & Upgrading
--
major
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Frédéric Buclin, Assigned: Frédéric Buclin)

Tracking

4.1.3
Bugzilla 4.0
Bug Flags:
approval +
approval4.2 +
blocking4.2 +
approval4.0 +

Details

Attachments

(1 attachment)

925 bytes, patch
Max Kanat-Alexander
: review+
Details | Diff | Splinter Review
(Assignee)

Description

6 years ago
Perl 5.15.1 has version.pm 0.93, but ActiveState already offers it as an update via the Perl Package Manager (ppm) for at least Perl 5.14.1 (I didn't check for 5.12.4). Also, Linux distros could do the same if they want to (and some probably do). Since version.pm 0.92, negative values for $VERSION are no longer allowed, and an error is thrown if either $VERSION is negative or you try to compare $VERSION to a negative value. In this last case, the reason is that Perl automagically converts the negative value into a version object, but as version.pm now forbids them, an error is thrown. This makes checksetup.pl to die due to line 712 in Bugzilla::Install::Requirements::_checking_for():

  if ($found and $found eq "-1")

$found = $module->VERSION || -1; and so is a version object when the module being called returns a version object (most Perl modules still return a string, but some others return a version object, such as DBD::Pg). In that case, "-1" is converted into an illegal (negative) version object and checksetup.pl dies:

"Invalid version format (non-numeric data) at Bugzilla/Install/Requirements.pm line 712."

IMO, we shouldn't try to set $found to -1 when the module cannot be found. $found should simply be undefined. I know _checking_for() currently uses undefined for "module_unknown_version", but I doubt such modules exist (probably CPAN has a check to reject the upload of such modules).
Flags: blocking4.2+
(Assignee)

Comment 1

6 years ago
If you want to reproduce the error with version.pm 0.92 or newer, simply run this testcase from the shell:

perl -wE 'package Foo; use version; our $VERSION = qv("0.89.2"); my $ver = Foo->VERSION; say $ver unless $ver eq "-1"'
(Assignee)

Comment 2

6 years ago
Created attachment 552915 [details] [diff] [review]
patch, v1

If it's a reference, then it's a version object. In that case, it cannot be -1.
Assignee: installation → LpSolit
Status: NEW → ASSIGNED
Attachment #552915 - Flags: review?(mkanat)

Comment 3

6 years ago
Comment on attachment 552915 [details] [diff] [review]
patch, v1

Review of attachment 552915 [details] [diff] [review]:
-----------------------------------------------------------------

Looks great.
Attachment #552915 - Flags: review?(mkanat) → review+

Updated

6 years ago
Flags: approval4.2+
Flags: approval4.0+
Flags: approval+
(Assignee)

Comment 4

6 years ago
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Install/Requirements.pm
Committed revision 7923.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified Bugzilla/Install/Requirements.pm
Committed revision 7903.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.0/
modified Bugzilla/Install/Requirements.pm
Committed revision 7644.
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Summary: version.pm 0.92 and newer forbids negative values, making checksetup.pl to fail → version.pm 0.92 and newer forbids negative values, making checksetup.pl fail with the error "Invalid version format"
Duplicate of this bug: 679290
You need to log in before you can comment on or make changes to this bug.