Bug 175468 - error on version check during "cpan r"
error on version check during "cpan r"
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: perl (Show other bugs)
4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jason Vas Dias
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-12-11 03:13 EST by Ralf Corsepius
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-12-20 12:56:39 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ralf Corsepius 2005-12-11 03:13:26 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050923 Fedora/1.7.12-1.5.1

Description of problem:
Running cpan I am observing this strange message:

Could not eval '
            package ExtUtils::MakeMaker::_version;
            no strict;

            local $DBD::Pg::VERSION;
            $DBD::Pg::VERSION=undef; do {
                  if $DBD::Pg::VERSION != 1.32 && $DBD::Pg::VERSION < 1.41;
            }; $DBD::Pg::VERSION
        ' in /usr/lib/perl5/vendor_perl/5.8.6/DBIx/DBSchema/DBD/Pg.pm: syntax error at (eval 256) line 7, near "if $DBD::Pg::VERSION "


Version-Release number of selected component (if applicable):
perl-5.8.6-18

How reproducible:
Always

Steps to Reproduce:
Using a configured cpan, using FC4 + FE4:

1. yum install perl-DBIx-DBSchema
2. echo "r" | cpan > log



Actual Results:  See log above.

Expected Results:  Function, no error nor warning.


Additional info:

Uninstalling perl-DBIx-DBSchema lets this error disappear.
Comment 1 Jason Vas Dias 2005-12-15 14:59:53 EST
This is NOT a perl bug - this is bad perl code in the DBIx::DBSchema module.

This is an invalid perl statement:
---
do {
    if $DBD::Pg::VERSION != 1.32 && $DBD::Pg::VERSION < 1.41;
   }; 
---

Presumably, you downloaded DBIx::DBSchema from cpan and installed it -
neither Fedora Core nor Fedora Extras provide this module.

Personally, I wouldn't trust any module that ships with invalid perl code
such as the above - I recommend that you uninstall it.

If you want to persevere with DBIx::DBSchema, I suggest raising a bug
at the developer's CPAN site: 
  http://search.cpan.org/~ivan/DBIx-DBSchema-0.28/DBSchema.pm#BUGS
Comment 2 Ralf Corsepius 2005-12-15 19:51:17 EST
(In reply to comment #1)
> This is NOT a perl bug - this is bad perl code in the DBIx::DBSchema module.
> 
> This is an invalid perl statement:
> ---
> do {
>     if $DBD::Pg::VERSION != 1.32 && $DBD::Pg::VERSION < 1.41;
>    }; 
> ---
Yes, but ...

this line orginates from cpan's processing of this block (line 6+) from
/usr/lib/perl5/vendor_perl/5.8.6/DBIx/DBSchema/DBD/Pg.pm:

die "DBD::Pg version 1.32 or 1.41 (or later) required--".
    "this is only version $DBD::Pg::VERSION\n"
  if $DBD::Pg::VERSION != 1.32 && $DBD::Pg::VERSION < 1.41;

The do { if ...; }; definitely is invalid Perl, but I don't see what's wrong
with the original code from Pg.pm above.

> Presumably, you downloaded DBIx::DBSchema from cpan and installed it -
> neither Fedora Core nor Fedora Extras provide this module.
FE provides this module, c.f.
http://download.fedora.redhat.com/pub/fedora/linux/extras/4/i386/perl-DBIx-DBSchema-0.28-1.fc4.noarch.rpm

I am its maintainer - This PR is part of investigating on what's wrong with it.
Comment 3 Jason Vas Dias 2005-12-20 11:31:04 EST
OK, sorry - I'll take another look into this. The Fedora Extras "Search"
facility finds nothing for a TitleSearch of 'perl-DBIx-DBSchema', so I 
assumed it wasn't in FE .  
Perhaps it's time to upgrade CPAN in FC-4 - investigating ...
Comment 4 Jason Vas Dias 2005-12-20 12:34:09 EST
Yes, this is a CPAN problem - but it still occurs with the latest 1.8 CPAN 
version.

The workaround is to simply move DBIx/DBSchema/DBD/Pg.pm's '$VERSION' setting
up a few lines:

---
--- DBSchema/DBD/Pg.pm  2005-04-07 04:14:52.000000000 -0400
+++ /tmp/Pg.pm  2005-12-20 12:26:37.000000000 -0500
@@ -2,13 +2,14 @@

 use strict;
 use vars qw($VERSION @ISA %typemap);
+$VERSION = '0.10';
+
 use DBD::Pg 1.32;
 die "DBD::Pg version 1.32 or 1.41 (or later) required--".
     "this is only version $DBD::Pg::VERSION\n"
   if $DBD::Pg::VERSION != 1.32 && $DBD::Pg::VERSION < 1.41;
 use DBIx::DBSchema::DBD;

-$VERSION = '0.10';
 @ISA = qw(DBIx::DBSchema::DBD);
--

Then all is OK with cpan 'r' . 

Yes, this is very weird, and is an upstream CPAN issue - I'll take this up with
the CPAN developer.
Comment 5 Jason Vas Dias 2005-12-20 12:49:22 EST
Perhaps this extract from 'man CPAN' might shed some light on this issue:
"
  Finding packages and VERSION

       This module presumes that all packages on CPAN

       · declare their $VERSION variable in an easy to parse manner. 
         This prerequisite can hardly be relaxed because it consumes far 
         too much memory to load all packages into the running program just
         to determine the $VERSION variable. Currently all programs that are
         dealing with version use something like this

             perl -MExtUtils::MakeMaker -le \
                 ’print MM->parse_version(shift)’ filename

         If you are author of a package and wonder if your $VERSION can be 
         parsed, please try the above method.
"

$ perl -MExtUtils::MakeMaker -le 'print MM->parse_version(shift)' DBSchema/DBD/Pg.pm
Could not eval '
            package ExtUtils::MakeMaker::_version;
            no strict;

            local $DBD::Pg::VERSION;
            $DBD::Pg::VERSION=undef; do {
                  if $DBD::Pg::VERSION != 1.32 && $DBD::Pg::VERSION < 1.41;
            }; $DBD::Pg::VERSION
        ' in DBSchema/DBD/Pg.pm: syntax error at (eval 4) line 7, near "if
$DBD::Pg::VERSION "
undef

( then move the $VERSION setting up a few lines as above )

$ perl -MExtUtils::MakeMaker -le 'print MM->parse_version(shift)' DBSchema/DBD/Pg.pm
0.10

This also happens with the latest ExtUtils::MakeMaker 6.3 , so I guess this
is simply a limitation of all MakeMaker implementations that module writers
have to work within, as mentioned in the CPAN documentation.
 
Comment 6 Ralf Corsepius 2005-12-20 13:07:25 EST
(In reply to comment #5)
> Perhaps this extract from 'man CPAN' might shed some light on this issue:
> [...]
Thank you very much for this deep and thorough investigatation.

I'll file a PR against DBIx/DBSchema/DBD/Pg.pm at rt.cpan.org and will
give your "Version hack/patch" a try with packages in FE.

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