Repository navigation
WIP: #1127 P2c — misc tools (less/cpio/man/file/time/column/col/logger/locale) function + help - #1469
Merged
Merged
Conversation
… Refs #1462) time (GNU time, DOC-BASED contract): -f/--format with resource specifiers, -o/--output, -a/--append, -v/--verbose, -q/--quiet, and -p's GNU long name --portability (--posix kept as alias). locale (glibc): -a's long name is now --all-locales (--all kept as alias); --usage prints a short usage message and exits. col (util-linux col.c): long options from the oracle longopts table (--no-backspaces/--fine/--pass/--tabs/--spaces/--lines), -l default corrected to 32 lines (col.c:88,651), -h/-x mutual exclusion, and the default space->tab compression implemented per col.c:293-301 (was: never emitted tabs; -x semantics inverted). Input tabs now only move the column position, as in col.c. Unit tests added for each implemented option.
…1127, Refs #1462) Per util-linux logger.c (2.39.3), cited inline: - -n/--server now really sends: UDP by default, TCP with -T (last of -T/-d wins), -P port; RFC 5424 by default for remote, --rfc3164 for the BSD form; RFC 6587 octet-count framing with --octet-count, newline framing otherwise. -u/--socket writes to an AF_UNIX datagram socket (RFC 3164 local header, no hostname, logger.c:903). - --msgid and --sd-id/--sd-param shape the RFC 5424 header, with the reserved [timeQuality tzKnown=1] element first (logger.c:783ff). - --socket-errors takes a required argument (on|off|auto; logger.c:1141,891); invalid values warn and fall back to auto. - --journald[=FILE] parses one FIELD=value entry (logger.c:338ff), mapping MESSAGE/PRIORITY/SYSLOG_IDENTIFIER onto the port's sinks. - Declared-but-dead faces made real: -f logs the file line by line; stdin is logged per line (logger_stdin) instead of concatenated; -e drops empty lines; --prio-prefix parses per-line <NNN> prefixes (0..191, facility 0 inherits the default); -S truncates messages; -i/--id is an optional-argument option (--id=PID); the default tag is the login name (logger.c:945); --no-act suppresses writes; event-log write failures now exit nonzero. Unit tests cover stdin line splitting, -f, --prio-prefix, -S, -i, --no-act, --socket-errors validation, --journald and the RFC 5424 option set.
DOC-BASED (man-db documented contracts; no local oracle source): - -a/--all: every page argument is now displayed in turn (previously only the first); a missing page errors per name and the exit status is 1 if any page is missing. -w/--where loops over all operands too. - -k/--apropos: searches the built-in registry's names and descriptions, printing 'name - description' lines; a keyword with no match prints '<word>: nothing appropriate.' and the exit status is 1 when nothing matched at all. - -C/--config-file: a nonexistent file is an error; an existing file is accepted (its settings do not apply to the built-in registry). - -d/--debug: traces page lookups on standard error. - -7/--ascii and -D/--default: accepted (pages are plain ASCII text; no persistent option state to reset). - --catman and -Z/--ditroff: report the platform difference and exit 1, like -t/--troff. The REGISTER [DIFFERS] list no longer claims the implemented options are missing, and the no-argument usage summary lists the new options.
DOC-BASED (file(1) documented contract; spellings and outputs probed against the local file-5.45 binary): - --mime-encoding: prints only the charset part of the MIME string (us-ascii / utf-8 / iso-8859-1 / binary). - --extension and --apple: values derived from the built-in signature table, mirroring file-5.45's answers for the formats the port knows (pdf, png, jpeg/jpg/jpe/jfif, gif, zip, gz, bmp, exe; Apple pairs 8BIMJPEG / 8BIMGIFf / ????BMPp, UNKNUNKN elsewhere). Marked [DIFFERS]: GNU derives both from full magic-database entries. - -e/--exclude and --exclude-quiet: stage switches (soft, ascmagic, encoding, text gate the port's pipeline stages; apptype/compress/ elf/tar are accepted no-ops). An unknown test name errors for --exclude and is ignored for --exclude-quiet. - -l/--list: prints the built-in magic table and exits (needs no operands). -C/--compile: reports the platform difference, exit 1. - -d/--debug: traces classification on standard error. - Output-mode options (-i, --mime-encoding, --extension, --apple) resolve last-one-wins, as in GNU. Unit tests cover charset output, extension/apple values, exclusion semantics and the list/compile modes.
… Refs #1462) Per the cpio-2.15 oracle sources, cited inline: - -A/--append (main.c:616): copy-out only, requires -F (the oracle's usage-error text otherwise); new members are spliced in before the existing trailer (util.c:636 prepare_append). - --block-size (main.c:124-125,324): count of 512-byte blocks; the finished archive is zero-padded to a whole number of blocks; bad values fail with 'invalid block size'. - -D/--directory (main.c:115-116; util.c:1504 change_dir, called at the start of copy-in/copy-out/copy-pass): changes directory after the archive input is opened and read; with -d a missing directory is created first. - -V/--dot: one dot per member to stderr (copyout.c:831, copyin.c). - --device-independent/--reproducible (main.c:469-472,202-204): inode numbers renumbered sequentially from 1, directory nlink normalized to 2 (device fields were already written as 0). - --absolute-filenames: member names are resolved literally (a leading '/' names the current drive root) instead of folding through the payload-root boundary. - -L/--dereference: accepted; the port already archives the target's content (symlink-as-member storage remains unimplemented, as does extract-side symlink creation, which is privilege-gated). - -p copy-pass mode implemented (was a stub error): stdin-listed files are copied into the destination directory, honoring -d/-m/-v and --dot. Also: directory members now materialize on extract, zero-length files are extracted (and archived — create used to skip them as if unreadable). Unit tests cover append, block-size, device-independent renumbering, -D, --dot, copy-pass and the empty-file round trip.
…1127, Refs #1462) Per util-linux column.c (2.39.3), cited inline: - Default (non-table) mode now actually columnates instead of echoing the input (column.c:669-731): uniform pitch (maxlength + 8) rounded down to a tab stop, columns = width / pitch, entries padded with tabs/spaces exactly to pitch slots; entries fill down columns by default. Empty input lines are dropped unless -L/--keep-empty-lines. - -x is rebound to its GNU meaning --fillrows (row-major fill; column.c:820); --output-fields stays available as a long-only option. - -e is rebound to --table-header-repeat (column.c:758): a formfeed-only input line is a page break and the header row is re-emitted after it; --table-empty stays available long-only. - -E is rebound to --table-noextreme COLUMNS (column.c:755, required argument): when the table must shrink to fit the output width, the named columns' widths give way (libsmartcols semantics); --table-noescape stays available long-only. - --output-width is now actually read (it previously read --columns by mistake). - The REGISTER description no longer claims rows fill first by default (that is the -x behavior). Unit tests cover columnation geometry, --fillrows, empty-line handling, header repeat, noextreme shrinking and the --output-fields rebind.
DOC-BASED (GNU less documented contracts; interactive faces cannot
be exercised headless and are listed as such in the cluster report):
- --line-num-width: the -N number field uses the configured width
instead of a fixed 6; a negative width is a usage error.
- --rscroll: a chopped (-S) line now shows the rscroll character
(default '>', empty string disables) in its last column.
- --file-size: the prompt gains 'bytes <shown>/<total>'.
- --no-histdups: re-entering a search pattern removes its older
history entries, not only a trailing duplicate.
- --no-keypad: accepted (the Windows console has no keypad init
strings to suppress).
- --mouse: the console is switched to mouse input and wheel notches
scroll three lines (the original console mode is restored on exit
by ConsoleInputMode).
- --incsearch: while a / or ? pattern is typed, the prompt shows the
line its first match would land on ('[line N]', '[no match]' or
'[invalid pattern]'); the full screen-jump preview of GNU less is
not reproduced.
- F (follow mode) is implemented, with --follow-name: at EOF the
pager polls the file every 250 ms and jumps to the new end on
growth or truncation; a replaced file stops the follow unless
--follow-name is set, when it is picked up by name. -K makes a
quit key exit the pager from follow mode.
Unit tests cover option acceptance in the non-console path and the
negative width error; the interactive faces need a real console.
#1462) Cases whose GNU answers were verified against the oracle sources (col.c compression, column.c columnation) or the local file-5.45 binary (--mime-encoding charsets). A plain column -t table case is deliberately not added: the port's table renderer separates columns with two spaces where libsmartcols uses cell padding plus a one-space separator (smartcolsP.h colsep) — a pre-existing divergence outside this cluster's recorded scope, noted in the cluster report for follow-up.
CI x64: error C2660 in logger/man unit tests — the file path inside a TempDir is (tmp.path / name).wstring(); wpath() returns the directory itself. The baseline run of the same commit confirms the new differential cases all pass; its only unexpected case is the standing regressions/70-env red on main.
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
Adjudication of the PR #1469 x64 ctest failure: the TEST was wrong, not the product. The original invocation column -x 1,2 -N A,B,C -E -t is invalid for GNU column in three independent ways (util-linux 2.39.3 text-utils/column.c): -x/--fillrows takes no argument (:799), so '1,2' became a (nonexistent) file operand; -E/--table-noextreme requires an argument (:813), so it swallowed '-t' as its value; and -t/-x are mutually exclusive (:828-832). column exits non-zero with empty stdout, exactly as the product does. The three option faces are now exercised separately in valid shapes at the original assertion level (exit 0, non-empty stdout): -x in fillrows mode, and -t with -N names plus -E in table mode. Refs #1127, #1462
…(Refs #1127, #1462) CI on adf83eb failed all four build-bearing jobs (x64, arm64, compare, baseline) with a single first error: src/commands/cpio.cpp(564): error C2676: binary '+': 'std::wstring' does not define this operator ... literal_member_path_w builds the backslash form in a std::string but concatenated it onto std::wstring(drive) in the POSIX-root arm of the --absolute-filenames path. Convert with utf8_to_wstring first, the same conversion the function's plain return path already uses. Behavior contract unchanged: with absolute_names the member name is used literally (GNU cpio util.c:1277-1285, cpio_safer_name_suffix); on Windows the POSIX root anchors at the current drive. No user-visible text changed.
caomengxuan666
marked this pull request as ready for review
October 31, 2026 21:15
logger --socket-errors was missing from main's declared surface: implement its parse contract (logger.c:891-901, 1141) -- on/off set the mode, auto and any other value fall back to auto with the 'invalid argument: %s: using automatic errors' warning -- resolve auto as noact || stderr (logger.c:1305), and gate the local write failure on the resolved mode (logger.c:271-275). The existing invalid_socket_errors_value_warns pin now passes as written. The other three failures were pins written against the branch's pre-audit implementations: - column --output-fields does not exist in the oracle longopts (column.c:796-826); -x is --fillrows. Rewrite the pin to select columns through -H/--table-hide. - column -e header repeat needs named columns (column.c:246-248) and is page-length driven, not formfeed driven; without -N/-C there is no header and the first line is data. Rewrite the pin. - logger --journald is HAVE_LIBSYSTEMD-only in the oracle (logger.c:337-338, 1157-1159, 1281-1290); main declares it and refuses it explicitly, like -u/--socket. Rewrite the pin to the refusal contract. Refs #1462
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1127, Refs #1462 — P2c cluster of the #1127 P2 plan (claim posted on #1127). Implements the recorded missing options from tests/differential/help-coverage-raw.json for the misc group, function first, then matching help. Oracle-source-first per the 2026-10-31 ruling: cpio-2.15 and util-linux-2.39.3 sources are the contracts (file:line citations in code comments and the cluster report); file/less/man/time follow their documented contracts (DOC-BASED, to be audited by the W8 cluster).
Wave 1 (this push): time, locale, col.
Planned waves: logger, man, file, cpio, column, less — each with unit/differential cases.
CI is the build gate (no local MSVC). Do not merge — collector adjudicates.