| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sys_pipe() duplicates the shell's pipe ends above SYS_NFD and marks them
FD_CLOEXEC, so that other children do not inherit them. spawn()'s fd_map
hands the child the parent's descriptor as it is, without clearing the
flag the way dup2() would, so a mapping onto the child's 0..2 carried
FD_CLOEXEC into the child. The child could still write, but the next
exec inside it lost stdout: ps printed
FSUM6004 write error on standard output: EDC5113I Bad file descriptor
and a #!/bin/sh shim lost the pipe it was given.
Pass a plain duplicate, which fcntl F_DUPFD makes above SYS_NFD without
the flag, for every map entry that names a different descriptor, and
close the duplicates once spawn() has made the child. Entries that map
a descriptor onto itself are untouched.
tests/zos/fdmap.sh records the case: a pipe the shell made, read by a
child that execs.
Reported in #1.
|
|
|
A clean-slate POSIX shell for z/OS UNIX in the Almquist tradition, written
in C23 for Clang (Linux) and IBM Open XL C/C++ (z/OS).
- Parser, expansion, arithmetic, redirection, traps and builtins.
- Spawn-first execution: fd plans instead of fork+dup2, in-shell pure
builtins for pipelines and command substitution, $(a | b) without a
subshell.
- Flat .POSIX Makefile; asan, valgrind, bench, compdb and z/OS targets.
- Tests: posix (dash-generated), zash, process accounting, linux, zos.
Nothing has been compiled or run on z/OS yet.
|