Open wollmers opened 2 years ago
PERL5LIB=/usr/local/bin:/usr/local/lib
Try running it without this environment variable set.
I can't repro on perl 5.34.1 with a similar setup.
You might want to add some debugging info to your cpanm
executable around CPAN::Meta::Check, to get a better diagnosis where the error comes from. This seems to be some issue with the bundled CPAN::Meta::Check version (Changelog sayd it's fixed in the latest release) but I'm curious how it doesn't happen with my setup.
The cpanm
executable of perlbrew
$ which cpanm
/Users/helmut/perl5/perlbrew/bin/cpanm
seems to have CPAN::Meta::Check
version 0.012
$fatpacked{"CPAN/Meta/Check.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'CPAN_META_CHECK';
package CPAN::Meta::Check;$CPAN::Meta::Check::VERSION='0.012';use [...]
CPAN_META_CHECK
and not the latest 0.014 with
0.014 2016-11-25 13:09:01+01:00 Europe/Amsterdam
- Undef versions are now passed through to CPAN::Meta::Requirements
for the check, rather than failing with "Missing version" errors.
Sorry for just repeating in my own words what you already have written.
The diff of CPAN::Meta::Check
tells us it should work?
~/github/perl/CPAN-Meta-Check-0.012$ diff lib/CPAN/Meta/Check.pm ../CPAN-Meta-Check-0.014/lib/CPAN/Meta/Check.pm
2c2
< $CPAN::Meta::Check::VERSION = '0.012';
---
> $CPAN::Meta::Check::VERSION = '0.014';
21a22
>
23,24c24,26
< return "Missing version info for module '$module'" if $reqs->requirements_for_module($module) and not $version;
< return sprintf 'Installed version (%s) of %s is not in range \'%s\'', $version, $module, $reqs->requirements_for_module($module) if not $reqs->accepts_module($module, $version || 0);
---
> return sprintf 'Installed version (%s) of %s is not in range \'%s\'',
> (defined $version ? $version : 'undef'), $module, $reqs->requirements_for_module($module)
> if not $reqs->accepts_module($module, $version || 0);
31a34
>
33,34c36,38
< return "Missing version info for module '$module'" if not $version;
< return sprintf 'Installed version (%s) of %s is in range \'%s\'', $version, $module, $reqs->requirements_for_module($module) if $reqs->accepts_module($module, $version);
---
> return sprintf 'Installed version (%s) of %s is in range \'%s\'',
> (defined $version ? $version : 'undef'), $module, $reqs->requirements_for_module($module)
> if $reqs->accepts_module($module, $version);
79c83
< version 0.012
---
> version 0.014
OK, will try to boil it down with diagnostic messages before patching.
Yeah, if anything, I think upgrading CPAN::Meta::Check will hide the issue from you - seems to be you're getting an undef version for Digest.pm from your install path.
Is it possible that this one is used (Mac is case insensitive):
/usr/local/bin$ la digest
lrwxr-xr-x 1 helmut admin 29B 24 Apr 2021 digest -> ../Cellar/nss/3.60/bin/digest
This seems to have a valid VERSION:
~/perl5/perlbrew/perls/perl-5.34.1/lib/5.34.1$ perl -e 'use Module::Metadata; my $info=Module::Metadata->new_from_file("Digest.pm");print $info->version,"\n";'
1.19
It's possible - that's why I suggested earlier to remove it from your PERL5LIB
. At least worth trying.
It's it, reproducable now:
/usr/local/bin$ mv digest digest_removeMe
/usr/local/bin$ cpanm Digest; cpanm Digest
Digest is up to date. (1.20)
Digest is up to date. (1.20)
helmut@mbp:/usr/local/bin$ mv digest_removeMe digest
helmut@mbp:/usr/local/bin$ cpanm Digest; cpanm Digest
--> Working on Digest
Fetching file:///usr/local/Cellar/nss/3.60/bin/digest ... OK
tar: Error opening archive: Unrecognized archive format
! Failed to unpack digest: no directory
! Failed to fetch distribution
--> Working on Digest
Fetching file:///usr/local/Cellar/nss/3.60/bin/digest ... OK
tar: Error opening archive: Unrecognized archive format
! Failed to unpack digest: no directory
! Failed to fetch distribution
Using a fresh shell without [Dd]igest
in ./
:
~$ cpanm Digest; cpanm Digest
--> Working on Digest
Fetching http://www.cpan.org/authors/id/T/TO/TODDR/Digest-1.20.tar.gz ... OK
Configuring Digest-1.20 ... OK
Building and testing Digest-1.20 ... OK
Successfully installed Digest-1.20
1 distribution installed
--> Working on Digest
Fetching http://www.cpan.org/authors/id/T/TO/TODDR/Digest-1.20.tar.gz ... OK
Configuring Digest-1.20 ... OK
Building and testing Digest-1.20 ... OK
Successfully installed Digest-1.20
1 distribution installed
~$ mv /usr/local/bin/digest /usr/local/bin/digest_removeMe
~$ cpanm Digest; cpanm Digest
Digest is up to date. (1.20)
Digest is up to date. (1.20)
~$ mv /usr/local/bin/digest_removeMe /usr/local/bin/digest
Potentially this can happen with all targets that have homonyms.
I don't think you're supposed to have bin
directory in your PERL5LIB
now, so I'd say that's an invalid configuration. Though it's interesting It tries to load the version from the digest
binary file (without .pm
suffix) and it might be something to look into.
helmut@mbp:/usr/local/bin$ cpanm Digest; cpanm Digest
--> Working on Digest
Fetching file:///usr/local/Cellar/nss/3.60/bin/digest ... OK
tar: Error opening archive: Unrecognized archive format
! Failed to unpack digest: no directory
! Failed to fetch distribution
--> Working on Digest
Fetching file:///usr/local/Cellar/nss/3.60/bin/digest ... OK
tar: Error opening archive: Unrecognized archive format
! Failed to unpack digest: no directory
! Failed to fetch distribution
I mean this is red herring and is not the same as what you initially reported. cpanm
tries to load the file in the current directory with the same name in the argument list is a known issue.
For your original issue, remove /usr/local/bin
from PERL5LIB
and i believe it should be fixed.
I mean this is red herring and is not the same as what you initially reported.
cpanm
tries to load the file in the current directory with the same name in the argument list is a known issue.
I know and did a test without digest
in the current directory. See second half of my posting.
For your original issue, remove
/usr/local/bin
fromPERL5LIB
and i believe it should be fixed.
If I remove /usr/local/bin
from PERL5LIB
than it's obvious that the problem is not triggered:
~$ cpanm --version | grep PERL5LIB
PERL5LIB=
~$ cpanm Digest; cpanm Digest;
Digest is up to date. (1.20)
Digest is up to date. (1.20)
But that's more like a work-around.
Yep, just confirming that you're describing two different issues.
One is that cpanm Module
would read a file named Module
from the current directory if it exists. Known issue #564 difficult to fix without breaking backward compatibility.
Another is the original issue, which is that Module::Metadata would fail to look up a version from a file in your PERL5LIB path.
But that's more like a work-around.
I don't consider it a workaround. You specify a path /usr/local/bin
to PERL5LIB
which doesn't actually have any perl5 libraries, to confuse perl's include path. It definitely is worth looking why Module::Metadata tries to read the file digest
(and not Digest.pm
) and fail to extract the info, like I stated above.
I don't consider it a workaround. You specify a path
/usr/local/bin
toPERL5LIB
which doesn't actually have any perl5 libraries, to confuse perl's include path.
That's true. I checked what's in /usr/local/bin
(old cpanm and perlbrew) and it seems a relict, that it is set in .profile
to PERL5LIB
.
It definitely is worth looking why Module::Metadata tries to read the file
digest
(and notDigest.pm
) and fail to extract the info, like I stated above.
Read the wrong file should not happen. Maybe similar cases were the reason for the change in version 0.014 of CPAN::Meta::Check
, which IMHO does not solve the problem in all cases, and makes it harder to locate the real problem.
Maybe similar cases were the reason for the change in version 0.014 of CPAN::Meta::Check
I think the CPAN::Meta::Check change is that if a module depends on a module Foo::Bar
(for any version), and if Foo/Bar.pm
exists but has no $VERSION
set (common for sub modules inside a distribution), that should be handled as a success, rather than a failure. That's an OK change to bring in, but as you said it could masquerade the real issue in some cases.
Environment
OS: macOS Catalina Version 10.15.6 (19G73)
Symptom
Additional diagnostics