develooper Front page | perl.perl5.porters | Postings from March 2018

[perl #132935] [PATCH] ExtUtils::ParseXS: use literals for VERSIONin 'use Module VERSION'

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
March 5, 2018 02:56
Subject:
[perl #132935] [PATCH] ExtUtils::ParseXS: use literals for VERSIONin 'use Module VERSION'
Message ID:
rt-4.0.24-22762-1520218577-182.132935-15-0@perl.org
On Sun, 04 Mar 2018 18:24:12 -0800, jkeenan wrote:
> On Sun, 04 Mar 2018 07:10:18 GMT, skaji@outlook.com wrote:
> > This is a bug report for perl from skaji@outlook.com,
> > generated with the help of perlbug 1.40 running under perl 5.26.1.
> >
> >
> > -----------------------------------------------------------------
> > [Please describe your issue here]
> >
> > Currently in ExtUtils::ParseXS, the version check does not work
> > because we use variables for VERSION:
> >
> > ```
> > our $VERSION;
> > BEGIN {
> >   $VERSION = '3.38';
> > }
> > use ExtUtils::ParseXS::Constants $VERSION;
> > ```
> >
> > We must use literals for VERSION.
> > A patch for this is attached to this e-mail.
> >
> 
> Please see the explanation provided by Steffen Mueller in commit
> 71a65ad3b4b0678fcf5bd6ac3b7ad394accc8079 back in 2011:
> 
> #####
> ExtUtils::ParseXS: Explicitly require current version of submodules
> 
> Since there have been certain problems with parts of ExtUtils::ParseXS
> being shadowed by older installations of the module, this commit adds
> an explicit $VERSION to all submodules and requires them to have the
> same version as the main module. This doesn't actually fix any
> problem, but makes them more apparent as early as possible instead of
> failing with obscure compile errors when bad C is generated from the
> original XS.
> #####

That explains why version checks are a good idea.  It does not justify the fact that that commit failed to add any version checks.

This:

    use ExtUtils::ParseXS::Constants $VERSION;

is equivalent to:

BEGIN {
    require ExtUtils::ParseXS::Constants;
    'ExtUtils::ParseXS::Constants'->import;
}

And a call to a nonexistent import method is silently ignored.

I don’t like the patch, because of the maintenance burden it creates (multiple numbers to update).  I wouldn’t mind a patch that calls ->VERSION($VERSION) explicitly in a BEGIN block.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=132935

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About