1

I am trying to install Net::SSH::Perl using cpanm (from perlbrew and perl version 5.30). The installation fails with:

$ cpanm Net::SSH::Perl
--> Working on Net::SSH::Perl
Fetching http://www.cpan.org/authors/id/S/SC/SCHWIGON/Net-SSH-Perl-2.14.tar.gz ... OK
Configuring Net-SSH-Perl-2.14 ... OK
==> Found dependencies: Crypt::Curve25519
--> Working on Crypt::Curve25519
Fetching http://www.cpan.org/authors/id/A/AJ/AJGB/Crypt-Curve25519-0.06.tar.gz ... OK
Configuring Crypt-Curve25519-0.06 ... OK
Building and testing Crypt-Curve25519-0.06 ... FAIL
! Installing Crypt::Curve25519 failed. See /home/hakon/.cpanm/work/1587758019.381709/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Missing version info for module 'Crypt::Curve25519'
! Bailing out the installation for Net-SSH-Perl-2.14.

The problem with installing Crypt::Curve25519 is described in this issue. I downloaded the problematic module Crypt::Curve25519 and patched it:

git clone git@github.com:ajgb/crypt-curve25519.git
wget https://www.cpan.org/authors/id/S/SR/SREZIC/patches/Crypt-Curve25519-0.06-PR10-ANOTHERLINK.patch
cd crypt-curve25519
git apply ../Crypt-Curve25519-0.06-PR10-ANOTHERLINK.patch
perl Makefile.PL
make  # No errors now
make test
make install

However, when I try again to install Crypt::Curve25519 it still tries to install the broken module from CPAN:

$ cpanm Net::SSH::Perl
--> Working on Net::SSH::Perl
Fetching http://www.cpan.org/authors/id/S/SC/SCHWIGON/Net-SSH-Perl-2.14.tar.gz ... OK
Configuring Net-SSH-Perl-2.14 ... OK
==> Found dependencies: Crypt::Curve25519
--> Working on Crypt::Curve25519
Fetching http://www.cpan.org/authors/id/A/AJ/AJGB/Crypt-Curve25519-0.06.tar.gz ... OK
Configuring Crypt-Curve25519-0.06 ... OK
Building and testing Crypt-Curve25519-0.06 ... FAIL
! Installing Crypt::Curve25519 failed. See /home/hakon/.cpanm/work/1587758833.382749/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Missing version info for module 'Crypt::Curve25519'
! Bailing out the installation for Net-SSH-Perl-2.14.

How can I make cpanm use the installed patch instead (i.e. skip installation of Crypt::Curve25519 since it is already installed)?

Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174

2 Answers2

1

There's a few things to check:

  • cpanm knows where to find your patched version.
  • The patched version has a version that's higher than the one on CPAN. The module idea in CPAN assumes that you always want the latest, so ensure that yours is.
  • You don't want to install a patched module at the standard location because you don't want a cpan client to overwrite it.

Some other things that can work:

  • Force install the module and ignore the failures (cpanm has a --notest feature). The CPAN version is still installed, but that doesn't matter.
  • Have your patched version in a separate directory that's at the front of @INC so your program finds it first. This effectively hides the CPAN version.
brian d foy
  • 129,424
  • 31
  • 207
  • 592
  • *"cpanm knows where to find your patched version"* : I installed the patch with `make install` and it ended up at the standard location in `/home/hakon/perlbrew/perls/perl-5.30.0/lib/site_perl/5.30.0` so I still does not understand why `cpanm` cannot see that it is already installed – Håkon Hægland Apr 24 '20 at 20:28
  • The version numbers are also the same, but there was a warning when running `perl Makefile.PL` : *"WARNING: Setting VERSION via file 'lib/Crypt/Curve25519.pm' failed"* – Håkon Hægland Apr 24 '20 at 20:29
  • *"..but there was a warning.."* : and that seems to be the issue. I added a line `our $VERSION = 0.06;` to the file `lib/Crypt/Curve25519.pm` and reinstalled it. Now `cpanm Net::SSH::Perl` completed successfully! – Håkon Hægland Apr 24 '20 at 20:35
  • Feel free to update your answer with the above information – Håkon Hægland Apr 24 '20 at 20:58
1

The problem seems to be missing VERSION information in the module. By adding a line

our $VERSION = 0.06; 

to the top of the file lib/Crypt/Curve25519.pm and then reinstall, and then installing cpanm Net::SSH::Perl worked fine (it accepted the patched installation and did not try to download the broken version).

Here is the patch I used to lib/Crypt/Curve25519.pm:

diff --git a/lib/Crypt/Curve25519.pm b/lib/Crypt/Curve25519.pm
index 686b706..d9c2b3d 100644
--- a/lib/Crypt/Curve25519.pm
+++ b/lib/Crypt/Curve25519.pm
@@ -1,4 +1,5 @@
 package Crypt::Curve25519;
+our $VERSION = 0.06;
 #ABSTRACT: Generate shared secret using elliptic-curve Diffie-Hellman function

 use strict;
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174