Skip to content

audit W8: cpio + ncurses remainder + specials vs oracle (#1462) - #1472

Merged
caomengxuan666 merged 5 commits into
mainfrom
fix/audit-w8-specials
Oct 31, 2026
Merged

caomengxuan666 merged 5 commits into
mainfrom
fix/audit-w8-specials

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

W8 cluster of the #1462 oracle audit: cpio (GNU cpio 2.15 source), the ncurses remainder infocmp/tic/toe/clear/reset (ncurses 6.4 source; tput itself was #1461, audit-only here), and fixes found in the source-less set (lsattr). man/time/less are audit-only per the #1127 P2c boundary — see REPORT.md in the cluster workspace.

What changed

cpio (source-based, cpio-2.15):

  • Create is stat-driven: empty files and directories are archived (silently dropped before), missing names are per-file errors that fail the run, modes/mtimes come from the filesystem, -v names go to stderr so the archive stream stays clean.
  • Extract processes every member kind (empty files, directory members, symlinks attempted, others warned) and applies GNU's age rule: without -u, an existing file newer-or-same-age is not replaced ("not created" message); -u/--unconditional added.
  • -H crc writes real 070702 checksums; extraction verifies them with GNU's checksum-error message. -H is validated against the GNU name set; unknown names are a usage error, known-but-unimplemented formats are refused explicitly instead of silently writing newc under another label. The "--format only with --create" restriction is gone.
  • -t prints member names only; -t -v prints GNU long_format columns from the header. Every mode prints the "N block(s)" stderr report (512-byte units) unless --quiet. A bad leading magic is an error, not a silent empty success.

infocmp / tput: the builtin terminfo table moves verbatim from tput.cpp into src/commands/terminfo_table.h, shared by both. infocmp previously ignored operands and $TERM and always printed one hardcoded entry with rc 0; it now dumps the requested entry in GNU source format (canonical order, _nc_tic_expand escaping, -1 supported), keeps the shipped windows-ansi entry, and fails on unknown names like GNU. Multi-operand comparison modes report as unimplemented instead of silently answering for one name.

tic: a source-file operand fails on stderr with exit 1 (nothing is compiled) instead of printing the notice on stdout with exit 0.

reset: -q prints the resolved type and changes nothing (tset noset); -r always reports Terminal type is %s. on stderr; -s uses the resolved type (operand, else $TERM) with the csh setenv form when $SHELL ends in csh; the reset byte stream moves to stderr (GNU's reset_start(stderr, ...)), keeping stdout clean for eval $(reset -s).

clear: -x omits the scrollback (E3) sequence; -V added.

lsattr: -l/--long honored for plain file operands and -d (was directory-children only).

Tests: unit cases updated where they pinned the divergent behavior (cpio list shape, tic fake success, reset -q silence) and added per fix (cpio empty/dir roundtrip, crc verify + corruption, age rule, -H validation, bad magic, --quiet/-v list; infocmp operand/$TERM/unknown/-1; tic; reset -q/-r/-s/streams; clear -x; lsattr -l).

New user-visible strings use winux::i18n::format keys; the winuxcmd-i18n companion PR carries the zh-CN catalog entries + VERSION bump.

Refs #1462

…quested entry

The builtin terminfo table moves verbatim out of tput.cpp into
src/commands/terminfo_table.h so the ncurses family answers from one
oracle-verified subset. infocmp is rebuilt on it: it used to ignore
operands and $TERM entirely and always print one hardcoded entry with
exit code 0. It now dumps the requested terminal (operand, else $TERM)
in GNU infocmp source format (canonical capability order, _nc_tic_expand
escaping, -1 one-per-line), keeps the shipped windows-ansi entry, and
errors on unknown names exactly like GNU (strict lookup, unlike tput's
xterm fallback). Multiple operands report the unimplemented comparison
modes instead of silently answering for the first.

Refs #1462
tic: a source-file operand now fails on stderr with exit 1 (nothing is
compiled) instead of printing the notice on stdout with exit 0.
reset: -q prints the resolved type on stdout and changes nothing
(tset noset); -r always reports 'Terminal type is %s.' on stderr; -s
uses the resolved type (operand, else $TERM) with the csh setenv form
when $SHELL ends in csh; the reset byte stream moves to stderr,
matching reset_start(stderr, ...) in tset -- stdout stays clean for
eval $(reset -s).
clear: -x omits the scrollback (E3) sequence; -V added.

Refs #1462
print_one ignored the long-names flag; only directory children got the
long form. Pass cfg.long_names through like the children path does.

Refs #1462
Create: stat-driven member walk -- empty files and directories are
archived (they were silently dropped), missing names are per-file
errors and fail the run, modes/mtimes come from the filesystem, -v
names go to stderr so the archive stream stays clean, -H crc writes
real 070702 checksums.
Extract: every member kind is processed -- empty files written,
directory members created, symlink members attempted, unsupported
types warned; the GNU age rule applies without -u (existing file newer
or same age is not replaced, 'not created' message) and -u/--unconditional
overrides it; 070702 checksums are verified with GNU's message.
List: plain -t prints member names only; -v prints GNU long_format
columns built from the header (mode string, nlink, uid/gid, size,
ls-style date, ' -> target' for links).
All modes: the 'N block(s)' stderr report (512-byte units) with
--quiet to suppress; -H validated against the GNU format name set
(unknown = usage error; known-but-unimplemented = explicit refusal
instead of silently writing newc under another label); a stream with
a bad leading magic is an error, not a silent empty success; the
'--format only with --create' restriction is gone.

Refs #1462
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 31, 2026 18:43
@caomengxuan666
caomengxuan666 merged commit fe7721d into main Oct 31, 2026
8 of 9 checks passed
caomengxuan666 added a commit that referenced this pull request Oct 31, 2026
Conflicts in cpio.cpp, man.cpp, time.cpp and the cpio unit tests,
resolved semantically rather than by side:

cpio.cpp: main's #1472 (W8) rewrite is the base and keeps all of its
contract fixes (run_create/run_extract/run_list split over the
Member/parse_member walk, CRC checksum verification, the -u age
rule, --quiet + blocks report, -H format validation, per-file error
exit codes, empty-file/directory members). Ported onto it from this
branch: -A/--append (trailer splice, GNU main.c:664-666 wording),
--block-size and -B (io_block_size units, main.c:321/324-330, with
archive padding to whole blocks), -D/--directory (relative member
names joined against the directory operand on both the read and
write sides; the process working directory is never mutated, so -F
keeps resolving against the original directory as in GNU, where the
archive descriptor opens before change_dir), -V/--dot (dots to
stderr plus the terminating newline, copyout.c:831/copyin.c:1585),
--device-independent/--reproducible (inode numbers assigned from 1),
--absolute-filenames (POSIX-absolute member names taken literally),
-L/--dereference and -a/--reset-access-time (accepted), and the -p
copy-pass implementation this branch wrote (destination = the sole
positional operand; a missing destination is a usage error).

Flagged divergence resolved for the oracle: GNU prints copy-out AND
copy-in -v names to stderr (copyout.c:830, copyin.c:1584) and
copy-pass -v prints the OUTPUT name to stderr (copypass.c:319).
main's create path already used stderr; its extract path printed to
stdout and this branch printed all three to stdout - all paths now
use stderr. The branch's old '-          0 empty.txt' list-format
expectation was dropped with its test: main's plain table of
contents (names only) and its stronger empty-file/directory
round-trip test supersede it.

man.cpp: kept this branch's implemented options and main's fuller
oracle-grounded descriptions where the two overlapped (-w, -T).
time.cpp: kept this branch's implemented option set and format
engine, adopted main's precise -p wording (three decimal places,
's' suffix in the default format, 127/126/125 exit-status contract)
and dropped main's stale '[DIFFERS] ... not implemented' text for
-f/-o/-a/-v/-q, which this branch implements.

Tests: union of both sides (20 cpio cases): main's six #1462 cases
plus this branch's append/block-size/device-independent/directory/
dot/pass cases; the dot case now runs with --quiet so its stderr is
exactly the dots plus GNU's terminating newline.

Refs #1127, #1462
@caomengxuan666
caomengxuan666 deleted the fix/audit-w8-specials branch November 2, 2026 01:13
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 this pull request may close these issues.

1 participant