summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-25 12:19:41 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-25 12:19:41 -0600
commit5d830cb1c04da59553d3af848340162a7be9fa58 (patch)
treebab5c143f428cccb014c82a273a101bcb2fd62d5 /src
parent7c161e69efaf67349edb32e42c113e5c0b7944f7 (diff)
downloadzash-fix/zos-script-charset.tar.gz
z/OS: convert a script's character set only in an ASCII buildfix/zos-script-charset
input_push_fd() called sys_input_cvt() for every script on z/OS, and that routine converts to the program's own CCSID. In an ASCII build reading an IBM-1047 system it therefore either asked for EBCDIC-to-EBCDIC conversion, which is a no-op that returns 0, or read the bytes unconverted; SETCVTON on a descriptor that sys_dupfd() has renumbered returns 0 and converts nothing on this system either. The parser then saw EBCDIC and dropped the script. An EBCDIC build reads IBM-1047 natively and never wanted the call. With the conversion left to ASCII builds, posix/traps and scripts/signals pass on z/OS: 93 passed, 4 skipped, 0 failed. The untagged-file case still depends on SETCVTON with an explicit fccsid, which is unverified, so the VERIFY note stays.
Diffstat (limited to 'src')
-rw-r--r--src/input.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/input.c b/src/input.c
index f585d71..3bad009 100644
--- a/src/input.c
+++ b/src/input.c
@@ -7,6 +7,9 @@
#include <string.h>
#include <unistd.h>
+#include "shell.h"
+
+#include "charset.h"
#include "exec.h"
#include "interact.h"
#include "parser.h"
@@ -47,8 +50,10 @@ void input_push_fd(int fd, bool is_stdin) {
/*
* z/OS: read a script in whatever character set it is in. Not for
* stdin, whose conversion state the commands being run would share.
+ * An ASCII build needs it for its own scripts; an EBCDIC build reads
+ * IBM-1047 as it stands, and must not be handed a converted copy.
*/
- if (SYS_MVS && !is_stdin)
+ if (SYS_MVS && ZASH_ASCII && !is_stdin)
sys_input_cvt(fd);
if (is_stdin) {
if (isatty(fd))