Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl -pie doesn't preserve tagging or contents' codepage #64

Closed
covener opened this issue Jun 2, 2023 · 3 comments · Fixed by #87
Closed

perl -pie doesn't preserve tagging or contents' codepage #64

covener opened this issue Jun 2, 2023 · 3 comments · Fixed by #87
Assignees

Comments

@covener
Copy link

covener commented Jun 2, 2023

I found that the common perl -p -i -e has a confusing side effect of changing the files codepage. If the file will be read back in an env w/o conversion, it could cause an issue.

The Rocket port of perl, at least the old one on my system, doesn't change it.

#!/bin/sh

which perl

export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"

rm -f ebcdic-file
touch ebcdic-file
chtag -tc ibm1047 ebcdic-file
printf 12345 >> ebcdic-file
ls -T ebcdic-file
/bin/od -t x1 ebcdic-file

perl -p -i -e 's/12345/1111/' ebcdic-file
ls -T ebcdic-file
/bin/od -t x1 ebcdic-file
$ ./test.sh
/u/WASTST1/zopen/prod/perl/bin/perl
t IBM-1047    T=on  ebcdic-file
0000000000    F1  F2  F3  F4  F5
0000000005
t ISO8859-1   T=on  ebcdic-file
0000000000    31  31  31  31
0000000004

(sed port has the same problem)

@covener
Copy link
Author

covener commented Aug 30, 2023

zopencommunity/sedport#7

@covener
Copy link
Author

covener commented Apr 17, 2024

@IgorTodorovskiIBM any chance the recent work on gzip helps/applies to perl and sed with -i?
(bump)

@IgorTodorovskiIBM
Copy link
Collaborator

Nope, but thanks for bumping this, we'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants