From e2dcf35cf5caa1163878e2648bdcebdaa17bb8bf Mon Sep 17 00:00:00 2001 From: tg Date: Fri, 5 May 2017 21:17:31 +0000 Subject: [PATCH] catch z/OS not having $Config not filling in the __perlpath env correctly --- check.pl | 15 ++++++++++++++- check.t | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/check.pl b/check.pl index 5bb2333..e9c2437 100644 --- a/check.pl +++ b/check.pl @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.pl,v 1.48 2017/05/05 19:43:50 tg Exp $ +# $MirOS: src/bin/mksh/check.pl,v 1.49 2017/05/05 21:17:31 tg Exp $ # $OpenBSD: th,v 1.1 2013/12/02 20:39:44 millert Exp $ #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, @@ -297,11 +297,24 @@ foreach $env (('HOME', 'LD_LIBRARY_PATH', 'LOCPATH', 'LOGNAME', } $new_env{'CYGWIN'} = 'nodosfilewarning'; $new_env{'ENV'} = '/nonexistant'; + if (($os eq 'VMS') || ($Config{perlpath} =~ m/$Config{_exe}$/i)) { $new_env{'__perlname'} = $Config{perlpath}; } else { $new_env{'__perlname'} = $Config{perlpath} . $Config{_exe}; } +$new_env{'__perlname'} = $^X if ($new_env{'__perlname'} eq '') and -f $^X and -x $^X; +if ($new_env{'__perlname'} eq '') { + foreach $pathelt (split /:/,$ENV{'PATH'}) { + chomp($pathelt = `pwd`) if $pathelt eq ''; + my $x = $pathelt . '/' . $^X; + next unless -f $x and -x $x; + $new_env{'__perlname'} = $x; + last; + } +} +$new_env{'__perlname'} = $^X if ($new_env{'__perlname'} eq ''); + if (defined $opt_e) { # XXX need a way to allow many -e arguments... if ($opt_e =~ /^([a-zA-Z_]\w*)(|=(.*))$/) { diff --git a/check.t b/check.t index 12dbc56..456c32c 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.790 2017/05/05 19:43:50 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.791 2017/05/05 21:17:31 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -8457,7 +8457,7 @@ description: note: Ultrix perl5 t4 returns 65280 (exit-code 255) and no text XXX fails when LD_PRELOAD is set with -e and Perl chokes it (ASan) need-pass: no -category: !os:cygwin,!os:msys,!os:ultrix,!os:uwin-nt,!smksh,!shell:ebcdic-yes +category: !os:cygwin,!os:msys,!os:ultrix,!os:uwin-nt,!smksh env-setup: !FOO=BAR! stdin: print '#!'"$__progname"'\nprint "1 a=$ENV{FOO}";' >t1