diff options
Diffstat (limited to 'DESIGN.md')
| -rw-r--r-- | DESIGN.md | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -520,7 +520,7 @@ adds what it needs to work beside EBCDIC programs. | Situation | EBCDIC build | ASCII build | | --- | --- | --- | -| `>`, `>\|`, `>>` creating or truncating an untagged file, variable unset | nothing (as `/bin/sh`) | deferred text tag: CCSID of the first writer | +| `>`, `>\|`, `>>` creating or truncating an untagged file, variable unset | nothing (as `/bin/sh`) | new or empty target: tagged IBM-1047 text, the shell's writes converted; target with data: tag left alone, writes still converted | | `_TAG_REDIR_OUT` / `_ERR` = `TXT` or `BIN`, untagged empty target on fd 1 / 2 | deferred tag, text flag on / off | same | | target already tagged, or has data, or is a device | left alone | left alone | | `_TAG_REDIR_IN=TXT`, tagged input on fd 0 | `F_CONTROL_CVT` `SETCVTON` from the tag | same | @@ -530,6 +530,7 @@ adds what it needs to work beside EBCDIC programs. | here-document temp file | nothing | tagged IBM-1047 text | | script, `.` file, profile, `ENV` tagged in the other CCSID | conversion on for the descriptor | same | | untagged script | first 512 bytes sniffed (0x15 vs 0x0A newlines) | same | +| standard output or error inherited untagged, not a terminal | nothing (as `/bin/sh`) | tagged IBM-1047 text, conversion on | | process start | autoconvert left as the user set it | autoconvert switched on if off | Decisions and reasons: @@ -542,10 +543,21 @@ Decisions and reasons: - Pipeline stages. A prefix on a stage tags that stage's pipe end: `_TAG_REDIR_OUT=TXT a | b` tags `a`'s output, as documented for `/bin/sh`. -- The tag follows the writer. A deferred tag takes the CCSID of the - first program that writes, so an EBCDIC tool behind `>` in an ASCII - shell still produces a correctly tagged IBM-1047 file. -- Pipes in ASCII builds are IBM-1047. If they were tagged 819 (as +- The tag follows the writer, where the tag is deferred. A deferred tag + (the `_TAG_REDIR_*` cases) takes the CCSID of the first program that + writes, so an EBCDIC tool behind `>` in an ASCII shell still produces a + correctly tagged IBM-1047 file. +- The shell's own redirections write IBM-1047. In an ASCII build the file + a `>` creates, and an inherited standard output that is a file, are + tagged IBM-1047 and the shell's own writes are converted, so `echo x >f` + leaves the EBCDIC text `/bin/sh` would have left, and an ASCII reader + gets it back through the tag. That conversion is on the descriptor, so it + is the one thing a child could inherit that it does not want: a program + that writes binary turns conversion off for its own descriptor (gzip + does), and `tests/zos/tagging.sh` checks that an archive made through + zash is byte for byte the archive made without it. +- What is left of a file is only touched when it is untagged: a target + that already has a tag, or is a device, keeps its own.- Pipes in ASCII builds are IBM-1047. If they were tagged 819 (as zoslib does) an EBCDIC reader would see ASCII. Tagged 1047, ASCII writers are converted on write and ASCII readers on read. Between two ASCII programs that costs two conversions per byte. `set +o pipetag` |
