Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 543042

Summary: perl-module.eclass: should warn more clearly/loudly if ExtUtils-MakeMaker PERL_MM_OPT="INSTALL_BASE=" is already set
Product: Gentoo Linux Reporter: Thomas Raschbacher <lordvan>
Component: EclassesAssignee: Gentoo Perl team <perl>
Status: RESOLVED FIXED    
Severity: minor CC: esigra, raphael.droz+floss
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=545304
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 239510    
Attachments: perl-module.eclass.patch
test failure logic script
perl-module.eclass.patch
perl-module.eclass.patch
perl-module.eclass.patch
updated patch
updated patch, also for bug 495044

Description Thomas Raschbacher gentoo-dev 2015-03-12 10:28:06 UTC
I just had errors like this:

>>> Configuring source in /var/tmp/portage/dev-perl/TimeDate-2.300.0/work/TimeDate-2.30 ...
* Using ExtUtils::MakeMaker
* perl Makefile.PL PREFIX=/usr INSTALLDIRS=vendor INSTALLMAN3DIR=none DESTDIR=/var/tmp/portage/dev-perl/TimeDate-2.300.0/image/
Checking if your kit is complete...
Looks good
Only one of PREFIX or INSTALL_BASE can be given.  Not both.

turns out i had this set in my .bashrc:

PERL_MB_OPT="--install_base \"/home/lordvan/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/home/lordvan/perl5"; export PERL_MM_OPT;

(i had no idea this was set anymore)

Would be nice to receive a warning that this is set in the user's env.
Comment 1 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2015-03-12 20:24:48 UTC
Given the propensity of this leakage causing installation failures, I would move to have this warning as early as possible, perhaps even pkg_pretend, and make it potentially fatal ( unsure if that is justified entirely though )

Its also worth mentioning the ENV flag is PERL_MM_OPT, and the bad flag is within that, so it possibly also needs some kind of CFLAGS-esque stripping/parsing logic done.
Comment 2 Patrice Clement gentoo-dev 2015-03-14 23:48:08 UTC
After a long discussion in #gentoo-perl, we've settled with displaying a warning when these 5 variables are already set by the user: PERL_MM_OPT, PERL5LIB, PERL5OPT, PERL_MB_OPT, PERL_CORE. Gotta get a patch out now...
Comment 3 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2015-03-15 00:31:55 UTC
Created attachment 398942 [details, diff]
perl-module.eclass.patch

Attached is my proposed solution.

1. It reports a general warning if any bad env vars, but only prints that general warning once.

2. It prints each bad ENV var and their value.

3. And only after doing all warnings, does it fatalise.

This aims to make it clear from the start *all* bad env vars instead of requiring a fix/die loop for the user.
Comment 4 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2015-03-15 00:37:26 UTC
Created attachment 398944 [details]
test failure logic script

Attached is the test script I developed the logic with for isolated testing.

( die is intentionally known not supported here, because yolo )

> $ bash test.sh
> 
> $ PERL_MB_OPT="Bad value" bash test.sh  
> Bad ENV values found. Please unset from ENV ( ~/.bashrc, package.env, etc ) or set I_KNOW_WHAT_IM_DOING=1
>     PERL_MB_OPT="Bad value"
> test.sh: line 27: die: command not found
> 
> $ PERL_MB_OPT="Bad value" PERL5OPT="Evil" bash test.sh 
> Bad ENV values found. Please unset from ENV ( ~/.bashrc, package.env, etc ) or set I_KNOW_WHAT_IM_DOING=1
>    PERL5OPT="Evil"
>    PERL_MB_OPT="Bad value"
> test.sh: line 27: die: command not found
> 
> $ PERL_MB_OPT="Bad value" PERL5OPT="Evil" I_KNOW_WHAT_IM_DOING=1 bash test.sh 
> Potentially bad ENV values found but I_KNOW_WHAT_IM_DOING=1
>    PERL5OPT="Evil"
>    PERL_MB_OPT="Bad value"
>
Comment 5 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2015-03-15 00:42:02 UTC
Created attachment 398946 [details, diff]
perl-module.eclass.patch

.... this time fixing tab/space difference.
Comment 6 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2015-03-15 01:53:17 UTC
Created attachment 398948 [details, diff]
perl-module.eclass.patch

3rd revision linearising the logic better and reducing the variability of messages, and using die appropriately.
Comment 7 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2015-03-15 03:49:08 UTC
Created attachment 398956 [details, diff]
perl-module.eclass.patch

Fixed name of function being wrong and bad whitespace at EOL.
Comment 8 Andreas K. Hüttel archtester gentoo-dev 2015-03-15 13:24:26 UTC
Created attachment 398972 [details, diff]
updated patch

* fix the variable name
* make the log priority depend on the circumvention setting
* better wording for non-natives
* remove the variable name from the docs :)
Comment 9 Andreas K. Hüttel archtester gentoo-dev 2015-03-15 15:05:41 UTC
Created attachment 398984 [details, diff]
updated patch, also for bug 495044

* make the if conditionals actually work
* improve error output
* combine with patch for bug 495044
Comment 10 Andreas K. Hüttel archtester gentoo-dev 2015-03-15 17:23:30 UTC
+  15 Mar 2015; Andreas K. Huettel <dilfridge@gentoo.org> perl-module.eclass:
+  Detect dangerous environment variables, bug 543042; support
+  Module::Build::Tiny directly, bug 495044
+
Comment 11 Andreas K. Hüttel archtester gentoo-dev 2015-03-21 22:48:55 UTC
*** Bug 454450 has been marked as a duplicate of this bug. ***