Why would a powershell script behave differently if it was called from Cygwin? -
ls typically run powershell scripts cygwin this:
$ powershell ./scriptname.ps1
it works well, today found instance script fails when called cygwin, succeeds when called powershell. have similar script succeeds in both cases.
this script works both ways:
buildopenssl32.ps1
param ([string]$prefix = $(resolve-path .)) $adjprefix = $prefix -replace "\\", "/" $prefix32 = "${adjprefix}/win32" new-item -erroraction ignore -itemtype directory -path $prefix32 pushd ${prefix32}/openssl-1.0.2j write-host "building openssl x86 $prefix32 ..." write-host "configuring..." perl configure debug-vc-win32 --prefix=$prefix32 ms\do_nasm write-host "building..." cmd /c "`"${env:vs140comntools}vsvars32.bat`" && nmake /f ms\nt.mak && nmake /f ms\nt.mak install" popd write-host "...done building openssl x86"
this script works when called powershell directly, fails wen called cygwin:
buildopenssl64.ps1
param ([string]$prefix = $(resolve-path .)) $adjprefix = $prefix -replace "\\", "/" $prefix64 = "${adjprefix}/win64" new-item -erroraction ignore -itemtype directory -path $prefix64 pushd ${prefix64}/openssl-1.0.2j write-host "building openssl x64 $prefix64 ..." write-host "configuring..." perl configure debug-vc-win64a --prefix=$prefix64 ms\do_win64a write-host "building..." cmd /c "`"${env:vs140comntools}../../vc/vcvarsall.bat`" amd64 && nmake /f ms\nt.mak && nmake /f ms\nt.mak install" popd write-host "...done building openssl x64"
the error looks this:
c:\cygwin64\home\mrixman\openssl5\win64\openssl-1.0.2j>perl ms\uplink-x86_64.pl nasm 1>ms\uptable.asm can't open perl script "ms../crypto/perlasm/x86_64-xlate.pl": no such file or directory
why care how script invocation handled?
edit:
based on error appears, relevant difference in above scripts appears ms\do_nasm
vs ms\do_win64a
do_nasm.bat (cygwin friendly)
perl util\mkfiles.pl >minfo perl util\mk1mf.pl nasm vc-win32 >ms\nt.mak perl util\mk1mf.pl dll nasm vc-win32 >ms\ntdll.mak perl util\mk1mf.pl nasm bc-nt >ms\bcb.mak perl util\mkdef.pl 32 libeay > ms\libeay32.def perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
do_win64a.bat (error when grandparent shell cygwin)
perl util\mkfiles.pl >minfo cmd /c "nasm -f win64 -v" >nul 2>&1 if %errorlevel% neq 0 goto ml64 perl ms\uplink-x86_64.pl nasm > ms\uptable.asm # <-- line nasm -f win64 -o ms\uptable.obj ms\uptable.asm goto proceed :ml64 perl ms\uplink-x86_64.pl masm > ms\uptable.asm ml64 -c -foms\uptable.obj ms\uptable.asm :proceed perl util\mk1mf.pl vc-win64a >ms\nt.mak perl util\mk1mf.pl dll vc-win64a >ms\ntdll.mak perl util\mkdef.pl 32 libeay > ms\libeay32.def perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
edit 2:
i created script calls get-childitem env:
can @ how powershell environment differs when it's called cygwin (broken) when compared how looks when run start menu (working). converted lowercase case sensitivity mismatch doesn't cause problem.
for stumbles across post looking answer. have both cygwin (or similar) perl on path before activeperl.
having been looking while, considered being conflicting versions of perl when found comment , 2 previous comments regarding version output on openssl bug tracker. might save others time.
Comments
Post a Comment