| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
zash was AMODE 64, so calling the AMODE 31 IGGCSI00 needed assembler
glue (zos_csi.s) that switched addressing mode around the branch. Built
with -m32 the program is 31-bit itself: the call goes through a plain
function pointer, the work area and the saved registers live in one
31-bit block in C, and the glue is gone.
The rest of the tree follows the change: the build, the off-z/OS lint
shim, DESIGN.md and README.md, the benches, the Lean spec of the
pattern matcher, and the tests that recorded what the extra address bits
had changed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The search interface was reached through LINK, which asked the system to
find and attach the module on every call -- and completion issues a call
per Tab. The glue now LOADs the module on the first call, writes its
entry point into the block, and branches to it directly afterwards, and
the block itself is taken from 31-bit storage on the first search and
kept, because IGGCSI00 is AMODE 31 and all three of its addresses have
to stay below 2 GB.
The block is declared packed, so the compiler cannot add padding the
assembler's offsets do not know about, and aligned(8), so the save area
starts on a doubleword. Its name field is spelled in IBM-1047 bytes
rather than as a C string, so the module is named the same way whatever
character mode this build runs in.
Verified on the machine: SYS1.MA* returns SYS1.MACLIB, SYS1.* returns
135 names, and Tab in an interactive shell completes //'SYS1.MA to
//'SYS1.MACLIB' and lists the members of that PDS.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
DESIGN.md, README.md and the Doxygen comments leaned on semicolons to
join clauses and on trailing "which" clauses to add afterthoughts. Both
read as machine-written prose. Each joined clause is now its own
sentence, and the afterthoughts are either part of the sentence or a
sentence of their own.
Also corrected: README said C11 in two places (the tree builds C17), the
completion section still described the pre-HLQ-rule filters and the
64-call resume limit, and the z/OS job-control note still called
SPAWN_SETTCPGRP unverified.
|
| |
|
|
|
|
|
| |
A script owns descriptors 0..SYS_NFD-1 and the shell's own live above
them, so filling 3..9 is as far as a script can go; the spawn map keeps
the terminal duplicate reachable past them. The earlier '64' map was
guessing at a case the shell cannot present: back to SYS_NFD+16.
|
| |
|
|
|
|
| |
One 64 KB block, freed before the search returns, and a nested search is
refused rather than given a second one. The second catalog search is
skipped once the candidate list is full.
|
| |
|
|
|
|
|
|
|
| |
The map carried SYS_NFD+16 descriptors, so a script holding more pushed
the terminal's duplicate out of reach and its commands lost the
controlling terminal. 64 leaves room.
`make zos-check` now builds the EBCDIC program too and runs the
character-set tests against it, which nothing did before.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
spawn() sets the child's foreground process group from inherit.ctlttyfd
after it has closed every descriptor from fd_count up, so the shell's
terminal descriptor -- which lives above the script's five or so -- was
already gone by then. Every external command in an interactive shell
died with EDC5113I Bad file descriptor, while the same command outside a
terminal worked.
Carry the terminal descriptor in the fd map, so the child has it open for
exactly the tcsetpgrp() spawn() performs.
|
| |
|
|
|
| |
-Wcomment is right: a path spelled tests/zos/* starts a nested comment
marker.
|
| |
|
|
|
|
|
|
| |
The docs and three source headers still claimed the z/OS layer had never
been compiled. Both character modes build with ibm-clang, tests/zos/*
run it on the machine, LE's heap checker stands in for ASan, and AMBLIST
shows the CSI glue inside the program object. What is left is the set of
things no test reaches, which the VERIFY notes already name.
|
| |
|
|
|
|
|
| |
CVT, ASCB and now ECVT were dereferenced without a check; a null there
would be an S0C4 in 'sysinfo', in 'read -t' timeouts and at job-table
refresh. A shell may run where PSAAOLD or the ECVT pointer is not set,
so report an empty field as sys_info() already does for a null job name.
|
| | |
|
| |
|
|
| |
redirects, std streams
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tagging and conversion (sys_zos.c, redir.c, input.c, var.c, exec.c):
- _TAG_REDIR_IN/OUT/ERR as /bin/sh documents them, cached by variable
hooks so redirection tests a byte; honoured as a prefix on external
commands and on pipeline stages.
- ASCII builds tag new output and here-document files as text, tag
pipes IBM-1047 (set +o pipetag to stop), and switch on autoconvert.
- Scripts, . files, profile and ENV are read in either character set:
tagged files get F_CONTROL_CVT, untagged ones are sniffed.
- tag/chtag primitives (sys_tag_get/sys_tag_set) for a builtin to come.
Data set completion (complete.c, mvsfmt.[ch], zos_csi.s):
- //'HLQ.PART, "//'HLQ.PART, //NAME (user HLQ), //'DSN(MEM, //DD:NAME
complete one qualifier at a time from the Catalog Search Interface,
PDS directories and the TIOT.
- IGGCSI00 is called through HLASM glue that switches to AMODE 31 and
keeps every register and parameter below the bar (VERIFY).
- The work-area, directory and TIOT decoders are portable and run on
Linux against a stand-in catalog that produces the real EBCDIC bytes,
including CSI resume and directory-block splits; fuzzed with
libFuzzer (make fuzz).
- A lone completion inside quotes now closes the quote.
Other z/OS features:
- time [-p] keyword with shell/children CPU split.
- set -o jobnames (_BPX_JOBNAME per command), set -o shareas
(_BPX_SHAREAS=YES for foreground commands only), set -o msgid
(ZSHnnnnE/W message IDs), ulimit -M (MEMLIMIT), ZOS_SYSNAME,
ZOS_SYSPLEX, ZOS_RELEASE, ZOS_ASID, ZOS_JOBNAME, prompt \S.
- BPXWDYN entry point for an alloc builtin to come.
Checking z/OS code off z/OS:
- make zos-lint compiles sys_zos.c against declarations transcribed
from the z/OS headers, and the rest with the MVS paths forced on.
- make mvs-asan runs the suite with the MVS paths on, under ASan/UBSan.
- make asan and make valgrind now check for leaks.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Language: $'...', aliases, function keyword, (( )) and let, typeset and
integer, print, whence, setvar, ulimit, read -t, RANDOM, SECONDS, the
ERR trap, trap -p, chdir, and more set -o names.
Job control: a job table, process groups, terminal hand-over through
the spawn layer, jobs/fg/bg, wait %n and kill %n.
Interactive: prompt expansion, a built-in line editor with emacs and vi
modes, completion, history with fc and HISTFILE, and libedit as a
compile-time alternative (make EDIT=libedit LDLIBS=-ledit).
The source is now C11 (was C23), uses typedef'd structs and enums, and
has Doxygen comments throughout. Adds .clang-tidy, .clangd and a
Doxyfile.
|
|
|
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.
|