Bug 214496 - perl.prov can miss $VERSION for packages defined in multiple blocks
Summary: perl.prov can miss $VERSION for packages defined in multiple blocks
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 7
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-11-07 21:08 UTC by James Ralston
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2007-08-28 11:04:58 UTC
Type: ---
Embargoed:


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

Description James Ralston 2006-11-07 21:08:05 UTC
/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 05:29:13 UTC
User pnasrat's account has been closed

Comment 2 Panu Matilainen 2007-08-22 06:34:58 UTC
Reassigning to owner after bugzilla made a mess, sorry about the noise...

Comment 3 James Ralston 2007-08-24 21:24:36 UTC
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 11:04:58 UTC
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.