Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module::CoreList::is_core("File::Spec::AmigaOS", "3.64") dies #16127

Closed
p5pRT opened this issue Aug 28, 2017 · 8 comments
Closed

Module::CoreList::is_core("File::Spec::AmigaOS", "3.64") dies #16127

p5pRT opened this issue Aug 28, 2017 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 28, 2017

Migrated from rt.perl.org#131976 (status was 'open')

Searchable as RT131976$

@p5pRT
Copy link
Author

p5pRT commented Aug 28, 2017

From ishigaki@cpan.org

Created by ishigaki@cpan.org

perl -MModule​::CoreList -E 'say Module​::CoreList​::is_core("File​::Spec​::AmigaOS", "3.64")' dies, saying "Invalid version format (version required)", because of an invalid version (;.64) for 5.023009.

Perl Info

Flags:
    category=library
    severity=low
    module=Module::CoreList

Site configuration information for perl 5.27.3:

Configured by ishigaki at Mon Aug 28 14:36:22 JST 2017.

Summary of my perl5 (revision 5 version 27 subversion 3) configuration:
   
  Platform:
    osname=linux
    osvers=3.16.0-4-amd64
    archname=x86_64-linux
    uname='linux charsbar.org 3.16.0-4-amd64 #1 smp debian 3.16.39-1 (2016-12-30) x86_64 gnulinux '
    config_args='-Dprefix=/home/ishigaki/.plenv/versions/5.27.3 -de -Dusedevel -A'eval:scriptdir=/home/ishigaki/.plenv/versions/5.27.3/bin''
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='4.9.2'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.19'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    Devel::PatchPerl 1.48


@INC for perl 5.27.3:
    /home/ishigaki/.plenv/versions/5.27.3/lib/perl5/site_perl/5.27.3/x86_64-linux
    /home/ishigaki/.plenv/versions/5.27.3/lib/perl5/site_perl/5.27.3
    /home/ishigaki/.plenv/versions/5.27.3/lib/perl5/5.27.3/x86_64-linux
    /home/ishigaki/.plenv/versions/5.27.3/lib/perl5/5.27.3


Environment for perl 5.27.3:
    HOME=/home/ishigaki
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/ishigaki/.plenv/versions/5.27.3/bin:/home/ishigaki/.plenv/libexec:/home/ishigaki/.plenv/plugins/perl-build/bin:/home/ishigaki/.rakudobrew/bin:/home/ishigaki/.rbenv/shims:/home/ishigaki/.rbenv/bin:/home/ishigaki/.plenv/shims:/home/ishigaki/.plenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Aug 28, 2017

From @jkeenan

On Mon, 28 Aug 2017 06​:02​:02 GMT, ishigaki wrote​:

This is a bug report for perl from ishigaki@​cpan.org,
generated with the help of perlbug 1.40 running under perl 5.27.3.

-----------------------------------------------------------------
[Please describe your issue here]

perl -MModule​::CoreList -E 'say
Module​::CoreList​::is_core("File​::Spec​::AmigaOS", "3.64")' dies, saying
"Invalid version format (version required)", because of an invalid
version (;.64) for 5.023009.

This is probably a side-effect from a problem previously corrected.

#####
$ git show b10f34 | cat
commit b10f34a
Author​: Dagfinn Ilmari Mannsåker <ilmari@​ilmari.org>
Date​: Tue Mar 22 21​:07​:38 2016 +0000

  [perl #127765] Fix bogus $File​::Spec​::AmigaOS​::VERSION
 
  ';' a single bitflip away from '3', which must have happened before
  e46aa1d got committed, since the SHA-1 hashes are all consistent.

Inline Patch
diff --git a/dist/PathTools/lib/File/Spec/AmigaOS.pm b/dist/PathTools/lib/File/Spec/AmigaOS.pm
index 9182d5e..7a5889c 100644
--- a/dist/PathTools/lib/File/Spec/AmigaOS.pm
+++ b/dist/PathTools/lib/File/Spec/AmigaOS.pm
@@ -4,7 +4,7 @@ use strict;
 use vars qw(@ISA $VERSION);
 require File::Spec::Unix;
 
-$VERSION = ';.64';
+$VERSION = '3.64';
 $VERSION =~ tr/_//d;
 
 @ISA = qw(File::Spec::Unix);
#####

I don't know enough about Module​::CoreList​::is_core() to know whether this is easily fixable.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Aug 28, 2017

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Aug 28, 2017

From @jkeenan

On Mon, 28 Aug 2017 15​:44​:49 GMT, jkeenan wrote​:

On Mon, 28 Aug 2017 06​:02​:02 GMT, ishigaki wrote​:

This is a bug report for perl from ishigaki@​cpan.org,
generated with the help of perlbug 1.40 running under perl 5.27.3.

-----------------------------------------------------------------
[Please describe your issue here]

perl -MModule​::CoreList -E 'say
Module​::CoreList​::is_core("File​::Spec​::AmigaOS", "3.64")' dies,
saying
"Invalid version format (version required)", because of an invalid
version (;.64) for 5.023009.

This is probably a side-effect from a problem previously corrected.

#####
$ git show b10f34 | cat
commit b10f34a
Author​: Dagfinn Ilmari Mannsåker <ilmari@​ilmari.org>
Date​: Tue Mar 22 21​:07​:38 2016 +0000

[perl #127765] Fix bogus $File​::Spec​::AmigaOS​::VERSION

';' a single bitflip away from '3', which must have happened before
e46aa1d got committed, since the SHA-1 hashes are all consistent.

diff --git a/dist/PathTools/lib/File/Spec/AmigaOS.pm
b/dist/PathTools/lib/File/Spec/AmigaOS.pm
index 9182d5e..7a5889c 100644
--- a/dist/PathTools/lib/File/Spec/AmigaOS.pm
+++ b/dist/PathTools/lib/File/Spec/AmigaOS.pm
@​@​ -4,7 +4,7 @​@​ use strict;
use vars qw(@​ISA $VERSION);
require File​::Spec​::Unix;

-$VERSION = ';.64';
+$VERSION = '3.64';
$VERSION =~ tr/_//d;

@​ISA = qw(File​::Spec​::Unix);
#####

I don't know enough about Module​::CoreList​::is_core() to know whether
this is easily fixable.

Thank you very much.

The patch attached corrects the problem -- but since I've made mistakes with Module-CoreList patches in the past, I'd like to have it reviewed first.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Aug 28, 2017

From @jkeenan

0001-Correct-badly-formatted-version-number.patch
From 2c7c30d106222420e0e302b777edc8a263d939b3 Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Mon, 28 Aug 2017 11:58:28 -0400
Subject: [PATCH] Correct badly formatted version number.

https://rt.perl.org/Ticket/Display.html?id=131976
---
 dist/Module-CoreList/lib/Module/CoreList.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dist/Module-CoreList/lib/Module/CoreList.pm b/dist/Module-CoreList/lib/Module/CoreList.pm
index 24bd67f..d2cf349 100644
--- a/dist/Module-CoreList/lib/Module/CoreList.pm
+++ b/dist/Module-CoreList/lib/Module/CoreList.pm
@@ -12349,7 +12349,7 @@ for my $version ( sort { $a <=> $b } keys %released ) {
             'ExtUtils::Embed'       => '1.33',
             'File::Find'            => '1.34',
             'File::Glob'            => '1.26',
-            'File::Spec::AmigaOS'   => ';.64',
+            'File::Spec::AmigaOS'   => '3.64',
             'IPC::Msg'              => '2.06_01',
             'IPC::Semaphore'        => '2.06_01',
             'IPC::SharedMem'        => '2.06_01',
-- 
2.7.4

@p5pRT
Copy link
Author

p5pRT commented Aug 29, 2017

From @ilmari

"James E Keenan via RT" <perlbug-followup@​perl.org> writes​:

On Mon, 28 Aug 2017 15​:44​:49 GMT, jkeenan wrote​:

On Mon, 28 Aug 2017 06​:02​:02 GMT, ishigaki wrote​:

This is a bug report for perl from ishigaki@​cpan.org,
generated with the help of perlbug 1.40 running under perl 5.27.3.

-----------------------------------------------------------------
[Please describe your issue here]

perl -MModule​::CoreList -E 'say
Module​::CoreList​::is_core("File​::Spec​::AmigaOS", "3.64")' dies,
saying
"Invalid version format (version required)", because of an invalid
version (;.64) for 5.023009.

This is probably a side-effect from a problem previously corrected.

#####
$ git show b10f34 | cat
commit b10f34a
Author​: Dagfinn Ilmari Mannsåker <ilmari@​ilmari.org>
Date​: Tue Mar 22 21​:07​:38 2016 +0000

[perl #127765] Fix bogus $File​::Spec​::AmigaOS​::VERSION

';' a single bitflip away from '3', which must have happened before
e46aa1d got committed, since the SHA-1 hashes are all consistent.

diff --git a/dist/PathTools/lib/File/Spec/AmigaOS.pm
b/dist/PathTools/lib/File/Spec/AmigaOS.pm
index 9182d5e..7a5889c 100644
--- a/dist/PathTools/lib/File/Spec/AmigaOS.pm
+++ b/dist/PathTools/lib/File/Spec/AmigaOS.pm
@​@​ -4,7 +4,7 @​@​ use strict;
use vars qw(@​ISA $VERSION);
require File​::Spec​::Unix;

-$VERSION = ';.64';
+$VERSION = '3.64';
$VERSION =~ tr/_//d;

@​ISA = qw(File​::Spec​::Unix);
#####

I don't know enough about Module​::CoreList​::is_core() to know whether
this is easily fixable.

Thank you very much.

The patch attached corrects the problem -- but since I've made mistakes
with Module-CoreList patches in the past, I'd like to have it reviewed
first.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

---
via perlbug​: queue​: perl5 status​: open
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=131976
From 2c7c30d106222420e0e302b777edc8a263d939b3 Mon Sep 17 00​:00​:00 2001
From​: James E Keenan <jkeenan@​cpan.org>
Date​: Mon, 28 Aug 2017 11​:58​:28 -0400
Subject​: [PATCH] Correct badly formatted version number.

https://rt-archive.perl.org/perl5/Ticket/Display.html?id=131976
---
dist/Module-CoreList/lib/Module/CoreList.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dist/Module-CoreList/lib/Module/CoreList.pm b/dist/Module-CoreList/lib/Module/CoreList.pm
index 24bd67f..d2cf349 100644
--- a/dist/Module-CoreList/lib/Module/CoreList.pm
+++ b/dist/Module-CoreList/lib/Module/CoreList.pm
@​@​ -12349,7 +12349,7 @​@​ for my $version ( sort { $a <=> $b } keys %released ) {
'ExtUtils​::Embed' => '1.33',
'File​::Find' => '1.34',
'File​::Glob' => '1.26',
- 'File​::Spec​::AmigaOS' => ';.64',
+ 'File​::Spec​::AmigaOS' => '3.64',
'IPC​::Msg' => '2.06_01',
'IPC​::Semaphore' => '2.06_01',
'IPC​::SharedMem' => '2.06_01',

While that fixes the immediate problem, it also causes Module​::CoreList
to lie​: 5.23.9 _did_ ship File​::Spec​::AmigaOS with that broken version
number.

An alternative patch would be to make is_core() more robust against
version parsing errors, à la the attached patch. This has the
additional benefit of only parsing the user-provided version once, and
reporting errors in it separately.

--
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
the consequences of." -- Skud's Meta-Law

@p5pRT
Copy link
Author

p5pRT commented Aug 29, 2017

From @ilmari

corelist-version-error-fix.patch
diff --git a/dist/Module-CoreList/lib/Module/CoreList.pm b/dist/Module-CoreList/lib/Module/CoreList.pm
index 24bd67f9ef..9cc7c3dee9 100644
--- a/dist/Module-CoreList/lib/Module/CoreList.pm
+++ b/dist/Module-CoreList/lib/Module/CoreList.pm
@@ -14442,6 +14442,11 @@ sub is_core
     # On the way if we pass the required module version, we can
     # short-circuit and return true
     if (defined($module_version)) {
+        my $module_version_object = eval { version->parse($module_version) };
+        if (!defined($module_version_object)) {
+            (my $err = $@) =~ s/^Invalid version format /Invalid version '$module_version' specified /;
+            die $err;
+        }
         # The Perl releases aren't a linear sequence, but a tree. We need to build the path
         # of releases from 5 to the specified release, and follow the module's version(s)
         # along that path.
@@ -14459,7 +14464,7 @@ sub is_core
             last RELEASE if $prn > $perl_version;
             next unless defined(my $next_module_version
                                    = $delta{$prn}->{changed}->{$module});
-            return 1 if version->parse($next_module_version) >= version->parse($module_version);
+            return 1 if eval { version->parse($next_module_version) >= $module_version_object };
         }
         return 0;
     }

@jkeenan
Copy link
Contributor

jkeenan commented Mar 2, 2020

The patch proposed by @ilmari in the ancestral RT ticket was applied as part of

commit a0f8d0d7c55d26446d5f8313a53e93b869f92005
Author:     Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
AuthorDate: Mon Jan 22 13:10:57 2018 +0000
Commit:     Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
CommitDate: Mon Jan 22 18:01:06 2018 +0000

    Improve handling of broken versions in Module::CoreList::is_core

Closing this issue.

@jkeenan jkeenan closed this as completed Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants