Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 543042 - perl-module.eclass: should warn more clearly/loudly if ExtUtils-MakeMaker PERL_MM_OPT="INSTALL_BASE=" is already set
Summary: perl-module.eclass: should warn more clearly/loudly if ExtUtils-MakeMaker PER...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Perl team
URL:
Whiteboard:
Keywords:
: 454450 (view as bug list)
Depends on:
Blocks: perl-eclass
  Show dependency tree
 
Reported: 2015-03-12 10:28 UTC by Thomas Raschbacher
Modified: 2015-04-02 09:55 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
perl-module.eclass.patch (perl-module.eclass.patch,1.65 KB, patch)
2015-03-15 00:31 UTC, Kent Fredric (IRC: kent\n) (RETIRED)
Details | Diff
test failure logic script (test.sh,836 bytes, text/plain)
2015-03-15 00:37 UTC, Kent Fredric (IRC: kent\n) (RETIRED)
Details
perl-module.eclass.patch (perl-module.eclass.patch,1.62 KB, patch)
2015-03-15 00:42 UTC, Kent Fredric (IRC: kent\n) (RETIRED)
Details | Diff
perl-module.eclass.patch (perl-module.eclass.patch,1.59 KB, patch)
2015-03-15 01:53 UTC, Kent Fredric (IRC: kent\n) (RETIRED)
Details | Diff
perl-module.eclass.patch (perl-module.eclass.patch-git,1.98 KB, patch)
2015-03-15 03:49 UTC, Kent Fredric (IRC: kent\n) (RETIRED)
Details | Diff
updated patch (perl-variables.patch,2.06 KB, patch)
2015-03-15 13:24 UTC, Andreas K. Hüttel
Details | Diff
updated patch, also for bug 495044 (envmbt.patch,4.39 KB, patch)
2015-03-15 15:05 UTC, Andreas K. Hüttel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***