zopencommunity / perlport

Port of perl to z/OS
Apache License 2.0
6 stars 3 forks source link

miniperl reads untagged files as ASCII instead of EBCDIC #5

Closed MikeFultonDev closed 2 years ago

MikeFultonDev commented 2 years ago

Consider:

Test that untagged files are read in as EBCDIC

input="/tmp/my.in" rm -f "${input}" ls /bin/sh >"${input}"

chtag -r "${input}"

actual=../perl5/miniperl i.pl rc=$? if [ $rc -gt 0 ]; then echo "Test Failed. Expected rc of 0. Got $rc" >&2 exit $rc fi

expected="/bin/sh" if [ "${actual}" != "${expected}" ]; then echo "Test Failed. Unexpected input. See file ${input} but expected: ${expected}" >&2 exit 8 fi

and

i.pl: open my $fh, '<', '/tmp/my.in' or die "Can't open /tmp/my.in for reading $!";

while(<$fh>) { print $_ }

close $fh or die "Can't close /tmp/my.in: $!";

In particular, this shows up because the code reads /usr/include/errno.h to find errors and such and it fails to find information because it is all EBCDIC (and therefore unrecognizable) as part of Errno/Errno_pm.PL