Bug 1157767 - Perl Module Dependency - Local vs. CPAN
Summary: Perl Module Dependency - Local vs. CPAN
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: ImageStreams
Version: 2.2.0
Hardware: Unspecified
OS: Linux
high
medium
Target Milestone: ---
: ---
Assignee: Jason DeTiberus
QA Contact: libra bugs
URL:
Whiteboard:
Depends On: 1039356
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-27 16:22 UTC by Jason DeTiberus
Modified: 2023-09-14 02:49 UTC (History)
13 users (show)

Fixed In Version: openshift-origin-cartridge-perl-1.28.0.1-1
Doc Type: Bug Fix
Doc Text:
Cause: The perl cartridge would not deploy when a module was encountered that was neither pre-installed nor in CPAN was included in an application. Consequence: Perl applications with local modules may not deploy properly. Fix: The perl cartridge has been changed to warn when a requested module is not pre-installed or available from CPAN. Result: Applications with local modules will deploy will deploy properly if the module is provided int he application repo.
Clone Of: 1039356
Environment:
Last Closed: 2015-02-12 13:09:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0220 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 2.2.4 bug fix and enhancement update 2015-02-12 18:08:20 UTC

Comment 3 Gaoyun Pei 2015-01-26 10:29:10 UTC
Test this with openshift-origin-cartridge-perl-1.28.0.1-1.el6op.noarch, puddle 2.2/2015-01-23.2.

Steps:
1. Create perl application with rhc:
   rhc app create pp perl-5.10

2. Add the Util module to the index.pl :
   sed -i "2i use Util;" index.pl

3. create the libs directory:
   mkdir -p libs

4. Create Util.pm module with some functionality: 
echo "package Util;
use strict;
use warnings;
use Exporter qw(import);
our @EXPORT_OK = qw(add multiply);
sub add {
    my ($x, $y) = @_;
    return $x + $y;
}
sub multiply {
    my ($x, $y) = @_;
    return $x * $y;
}
1;" >> libs/Util.pm 

5. Add module "Util","strict","warnings","Exporter" to file ".openshift/cpan.txt"

6.Push the change the application.
# git add ./
# git commit -anmp
[root@broker pp]# git push
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 680 bytes, done.
Total 7 (delta 2), reused 0 (delta 0)
remote: Stopping Perl cartridge
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Building git ref 'master', commit 1153196
remote: Building Perl cartridge
remote: ***  Installing modules from .openshift/cpan.txt
remote: --> Working on Exporter
remote: Fetching http://search.cpan.org/CPAN/authors/id/T/TO/TODDR/Exporter-5.70.tar.gz ... OK
remote: Configuring Exporter-5.70 ... OK
remote: Building Exporter-5.70 ... OK
remote: Successfully installed Exporter-5.70 (upgraded from 5.63)
remote: 1 distribution installed
remote: ! Finding Util on cpanmetadb failed.
remote: --> Working on Util
remote: Fetching http://search.cpan.org/CPAN/authors/id/C/CT/CTRLSOFT/Parse-Pidl-0.02.tar.gz ... OK
remote: Configuring Parse-Pidl-0.02 ... OK
remote: Building Parse-Pidl-0.02 ... OK
remote: Successfully installed Parse-Pidl-0.02
remote: 1 distribution installed
remote: Preparing build for deployment
remote: Deployment id is 57bd1f9e
remote: Activating deployment
remote: Starting Perl cartridge
remote: Application directory "/" selected as DocumentRoot
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://yes-pp-1.com.cn/~/git/pp.git/
   a3a5cc2..1153196  master -> master

It fails as the same as https://bugzilla.redhat.com/show_bug.cgi?id=1039356#c13

Comment 4 Brenton Leanhardt 2015-01-26 20:06:16 UTC
I'm not an expert in the perl cartridge but this following two scenarios appear to describe the currently functionality:

1) If a user creates a package that exactly matches a module in cpan.txt then the module in cpan.txt will win and it will attempt to be installed.  For example, a local package called Util and a cpan.txt like with the following contents:

Parse::Pidl::Util
strict
warnings
Exporter

This seems reasonable to me.

2) The apparent bug is if a users creates a package that happens to be a substring of any module in cpan.txt.  Here we seem to do the wrong thing and attempt to download from cpan.  This is because of  https://github.com/openshift/origin-server/blob/master/cartridges/openshift-origin-cartridge-perl/bin/build#L56

For example let's same my cpan.txt looks like this:

Parse::Pidl::Util
strict
warnings
Exporter

Line 56's "! grep Util cpan.txt" will be false which means the filter logic won't be run.  That's why eventually "cpanm -n Util" run which in turn tries to install Parse-Pidl-0.02.tar.gz.

If you look at the output from https://bugzilla.redhat.com/show_bug.cgi?id=1039356#c15 you will see the filter logic is actually not working and instead it's attempting to download the Util module from cpan.  It's likely at that the time the test was run Online's cpan mirror either did not have the Parse::Pidl or didn't have the logic that mapped Util to Parse::Pidl.  I think this bug actually still exists in Online.

Jakub, would you mind take a look to see if my assessment is accurate?

Comment 9 Gaoyun Pei 2015-02-03 06:57:07 UTC
Move this bug to VERIFIED according to Comment 5

Comment 11 errata-xmlrpc 2015-02-12 13:09:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0220.html

Comment 12 Red Hat Bugzilla 2023-09-14 02:49:48 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


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