Bug 214496 - perl.prov can miss $VERSION for packages defined in multiple blocks
perl.prov can miss $VERSION for packages defined in multiple blocks
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
7
All Linux
medium Severity low
: ---
: ---
Assigned To: Panu Matilainen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-07 16:08 EST by James Ralston
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-08-28 07:04:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch to correct perl.prov's behavior (586 bytes, patch)
2007-08-24 17:24 EDT, James Ralston
no flags Details | Diff

  None (edit)
Description James Ralston 2006-11-07 16:08:05 EST
/usr/lib/perl5/5.8.8/Getopt/Long.pm contains:

use vars qw($VERSION);
$VERSION        =  2.35;
# For testing versions only.
#use vars qw($VERSION_STRING);
#$VERSION_STRING = "2.35";

But rpm's perl.prov script can't parse the version number:

$ /usr/lib/rpm/perl.prov /usr/lib/perl5/5.8.8/Getopt/Long.pm 
perl(Getopt::Long)
perl(Getopt::Long::Parser)

As a result, trying to use a construct like this in a spec file will fail:

Requires: perl(Getopt::Long)
Conflicts: perl(Getopt::Long) < 2.30

...because as far as rpm is concerned, it doesn't know what version
perl(Getopt::Long) is providing.

The package versions in question are:

$ rpm -q perl rpm
perl-5.8.8-10
rpm-4.4.2-32

This is a minor bug, but still an annoying one.
Comment 1 Red Hat Bugzilla 2007-08-21 01:29:13 EDT
User pnasrat@redhat.com's account has been closed
Comment 2 Panu Matilainen 2007-08-22 02:34:58 EDT
Reassigning to owner after bugzilla made a mess, sorry about the noise...
Comment 3 James Ralston 2007-08-24 17:24:36 EDT
Created attachment 172460 [details]
patch to correct perl.prov's behavior

Well, here's the problem:

$ grep -E '^\s*(package|\$VERSION)' /usr/lib/perl5/5.8.8/Getopt/Long.pm
package Getopt::Long;
$VERSION	=  2.35;
package Getopt::Long::Parser;
package Getopt::Long;

The problem is, when /usr/lib/rpm/perl.prov sees a "package" statement, it
forgets about any previous $VERSION line it saw.  In other words, perl.prov is
expecting this:

$ grep -E '^\s*(package|\$VERSION)' /usr/lib/perl5/5.8.8/Getopt/Long.pm
package Getopt::Long;
$VERSION	=  2.35;
package Getopt::Long::Parser;
package Getopt::Long;
$VERSION	=  2.35;

But from reading /usr/lib/perl5/5.8.8/Getopt/Long.pm, this is clearly wrong;
the second "package Getopt::Long" definition is concatenating with the first
one.

I think perl.prov should try to match perl's behavior.	And we can test that:

$ cat native-perl-provides
#! /usr/bin/perl
use Getopt::Long;
use strict;
use warnings;
if (defined $Getopt::Long::VERSION) {
   print "perl(Getopt::Long) = $Getopt::Long::VERSION\n";
} else {
   print "perl(Getopt::Long)\n";
}
if (defined $Getopt::Long::Parser::VERSION) {
   print "perl(Getopt::Long) = $Getopt::Long::Parser::VERSION\n";
} else {
   print "perl(Getopt::Long::Parser)\n";
}

./native-perl-provides
perl(Getopt::Long) = 2.35
perl(Getopt::Long::Parser)

So, according to perl itself, Getopt::Long has a version, but
Getopt::Long::Parser does not.	That means that successive definitions of the
same package should NOT stomp a previously-found $VERSION.

The attached patch implements this behavior.
Comment 4 Panu Matilainen 2007-08-28 07:04:58 EDT
Fixed in rpm 4.4.2.2(-rc1) in next rawhide push. 4.4.4.2 final should find it's
way to F7 too eventually...

Thanks for the patch!

Note You need to log in before you can comment on or make changes to this bug.