From: Peter Rabbitson Date: Wed, 25 May 2016 15:14:23 +0000 (+0200) Subject: Fix more taint.t failures under local::lib X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2ff0298236251060746c44fad5bec5ece455c35c;p=dbsrgits%2FDBIx-Class.git Fix more taint.t failures under local::lib Add a CI run under l::l (when POISON_ENV is set) to weed this problem out once and for all Also relegate the test to xt/ - it will still run on smokers given 554484cb and has no value failing on an end-user system (CI runs the entire suite under prove -T anyhow) --- diff --git a/Changes b/Changes index 871b012..fb7673d 100644 --- a/Changes +++ b/Changes @@ -81,6 +81,7 @@ Revision history for DBIx::Class * Misc - Add explicit test for pathological example of asymmetric IC::DT setup working with copy() in t/icdt/engine_specific/sybase.t (GH#84) + - Fix t/54taint.t failing on local::lib's with upgraded Carp on 5.8.* - Fix invalid variable names in ResultSource::View examples - Typo fixes from downstream debian packagers (RT#112007) - Skip tests in a way more intelligent and speedy manner when optional diff --git a/maint/travis-ci_scripts/20_install.bash b/maint/travis-ci_scripts/20_install.bash index d5d3481..4fc50d0 100755 --- a/maint/travis-ci_scripts/20_install.bash +++ b/maint/travis-ci_scripts/20_install.bash @@ -64,6 +64,13 @@ elif [[ "$CLEANTEST" == "true" ]] && [[ "$POISON_ENV" != "true" ]] ; then purge_sitelib fi +if [[ "$POISON_ENV" = "true" ]] ; then + # create a perlbrew-specific local lib + perlbrew lib create travis-local + perlbrew use "$( perlbrew use | grep -oP '(?<=Currently using ).+' )@travis-local" + echo_err "POISON_ENV active - adding a local lib: $(perlbrew use)" +fi + # configure CPAN.pm - older versions go into an endless loop # when trying to autoconf themselves CPAN_CFG_SCRIPT=" diff --git a/maint/travis-ci_scripts/30_before_script.bash b/maint/travis-ci_scripts/30_before_script.bash index 2a8b0d7..f590ff0 100755 --- a/maint/travis-ci_scripts/30_before_script.bash +++ b/maint/travis-ci_scripts/30_before_script.bash @@ -35,8 +35,20 @@ if [[ "$MVDT" == "true" ]] ; then # the fulltest may re-upgrade DBI, be conservative only on cleantests # earlier DBI will not compile without PERL_POLLUTE which was gone in 5.14 parallel_installdeps_notest T/TI/TIMB/DBI-1.614.tar.gz + + # FIXME work around DBD::DB2 being silly: https://rt.cpan.org/Ticket/Display.html?id=101659 + if [[ -n "$DBICTEST_DB2_DSN" ]] ; then + echo_err "Installing same DBI version into the main perl (above the current local::lib)" + $SHELL -lic "perlbrew use $( perlbrew use | grep -oP '(?<=Currently using )[^@]+' ) && parallel_installdeps_notest T/TI/TIMB/DBI-1.614.tar.gz" + fi else parallel_installdeps_notest T/TI/TIMB/DBI-1.57.tar.gz + + # FIXME work around DBD::DB2 being silly: https://rt.cpan.org/Ticket/Display.html?id=101659 + if [[ -n "$DBICTEST_DB2_DSN" ]] ; then + echo_err "Installing same DBI version into the main perl (above the current local::lib)" + $SHELL -lic "perlbrew use $( perlbrew use | grep -oP '(?<=Currently using )[^@]+' ) && parallel_installdeps_notest T/TI/TIMB/DBI-1.57.tar.gz" + fi fi # Test both minimum DBD::SQLite and minimum BigInt SQLite diff --git a/t/lib/DBICTest/WithTaint.pm b/t/lib/DBICTest/WithTaint.pm index abad25d..b3cd66c 100644 --- a/t/lib/DBICTest/WithTaint.pm +++ b/t/lib/DBICTest/WithTaint.pm @@ -1,4 +1,3 @@ -# keep stricture tests happy -use strict; -use warnings; +package DBICTest::WithTaint; + 1; diff --git a/xt/dist/strictures.t b/xt/dist/strictures.t index 93feda8..8d15f12 100644 --- a/xt/dist/strictures.t +++ b/xt/dist/strictures.t @@ -41,6 +41,8 @@ find({ return if m{^(?: maint/Makefile.PL.inc/.+ # all the maint inc snippets are auto-strictured | + t/lib/DBICTest/WithTaint.pm # no stictures by design (trips up local::lib on older perls) + | t/lib/DBICTest/Util/OverrideRequire.pm # no stictures by design (load order sensitive) | t/lib/ANFANG.pm # no stictures by design (load speed sensitive) diff --git a/t/54taint.t b/xt/extra/taint.t similarity index 96% rename from t/54taint.t rename to xt/extra/taint.t index fbf0286..e8c6af1 100644 --- a/t/54taint.t +++ b/xt/extra/taint.t @@ -1,8 +1,22 @@ BEGIN { $ENV{DBICTEST_ANFANG_DEFANG} = 1 } +# When in taint mode, PERL5LIB is ignored (but *not* unset) +# Put it back in INC so that local-lib users can actually +# run this test. Use lib.pm instead of an @INC unshift as +# it will correctly add any arch subdirs encountered +# +# Yes, this is a lazy solution: adding -I args in the exec below is the +# more sensible approach, but no time to properly do it at present +use Config; +use lib ( + grep { length } + map { split /\Q$Config{path_sep}\E/, (/^(.*)$/)[0] } # untainting regex + grep { defined } + @ENV{qw(PERL5LIB PERLLIB)} # precedence preserved by lib +); + use strict; use warnings; -use Config; # there is talk of possible perl compilations where -T is fatal or just # doesn't work. We don't want to have the user deal with that. @@ -45,18 +59,6 @@ BEGIN { unless ($INC{'t/lib/DBICTest/WithTaint.pm'}) { exec( $perl, qw( -I. -Mt::lib::DBICTest::WithTaint -T ), __FILE__ ); }} -# When in taint mode, PERL5LIB is ignored (but *not* unset) -# Put it back in INC so that local-lib users can actually -# run this test. Use lib.pm instead of an @INC unshift as -# it will correctly add any arch subdirs encountered - -use lib ( - grep { length } - map { split /\Q$Config{path_sep}\E/, (/^(.*)$/)[0] } # untainting regex - grep { defined } - @ENV{qw(PERL5LIB PERLLIB)} # precedence preserved by lib -); - # We need to specify 'lib' here as well because even if it was already in # @INC, the above will have put our local::lib in front of it, so now an # installed DBIx::Class will take precedence over the one we're trying to test.