t/loc_tools.pl: find_locales() Don't destroy callers ENV
authorKarl Williamson <public@khwilliamson.com>
Wed, 29 Jan 2014 16:51:38 +0000 (09:51 -0700)
committerKarl Williamson <public@khwilliamson.com>
Wed, 29 Jan 2014 17:23:14 +0000 (10:23 -0700)
This code was recently moved from lib/locale.t to a new file essentially
unchanged, so that it could be common code.  It deletes several
environment variables, such as PATH,  to avoid interference with going
out and looking at the locales.  In lib/locale.t, those environment
variables are not needed again, but that isn't true of all the callers.
The solution is simply to localize the removal.

This should fix [perl #121106], but there remain test failures there.

t/loc_tools.pl

index 890f8e1..31d599e 100644 (file)
@@ -95,10 +95,10 @@ sub find_locales {  # Returns an array of all the locales we found on the
     # program without the taint mode getting grumpy.
 
     # $ENV{PATH} is special in VMS.
-    delete $ENV{PATH} if $^O ne 'VMS' or $Config{d_setenv};
+    delete local $ENV{PATH} if $^O ne 'VMS' or $Config{d_setenv};
 
     # Other subversive stuff.
-    delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
+    delete local @ENV{qw(IFS CDPATH ENV BASH_ENV)};
 
     if (-x "/usr/bin/locale"
         && open(LOCALES, "/usr/bin/locale -a 2>/dev/null|"))