Skip to content

Next minor: source-led parity and performance probes for cpio/free/lsof/man/top/tree/uptime/watch #114

Closed

Description

@caomengxuan666

Goal

Move the remaining easy-to-isolate command coverage gaps into the next small release after 0.14.0. The current release PR should keep its generated parity and performance evidence, while these eight commands get source-led plans, stable E2E probes, and performance baselines in the follow-up.

Commands:

  • cpio
  • free
  • lsof
  • man
  • top
  • tree
  • uptime
  • watch

Shared acceptance criteria

  • Read the upstream or closest practical open-source implementation before changing behavior or adding probes.
  • Document the upstream files inspected in the compatibility audit or the PR body for that follow-up.
  • Add at least one stable non-interactive E2E or parity probe for every command where local reference output is practical.
  • Add performance timing through scripts/benchmark-command-parity.py for every probe, even if the result is local-only shape validation because no matching GNU or MSYS reference exists.
  • Keep unsupported or Windows-specific options accepted when scripts depend on the option surface, but mark no-op or partial behavior in OPTION descriptions and source comments.
  • Refresh DOCS/generated/command_compatibility_matrix.* and DOCS/generated/command_performance_baseline.* after probes land.

Command plan

cpio

  • Upstream to inspect: GNU cpio archive read/write flow and pax/cpio header handling, plus any MSYS or Cygwin cpio behavior available locally.
  • Current focus: avoid claiming green list/extract parity while listing still has crash risk. Start with archive creation from a tiny fixture because that shape is stable and non-interactive.
  • Implementation work: harden archive reader error paths, validate header bounds before reading payloads, and make stdin/stdout binary paths explicit.
  • Probe plan: create an archive from a fixture file list, check exit 0 and binary output shape or checksum. Add list/extract probes only after crash path is fixed.

free

  • Upstream to inspect: procps-ng free.c display width, unit scaling, total/used/free/shared/buffers/cache/available rows, and human-readable mode.
  • Current focus: Windows memory counters should produce the same table shape without pretending Linux procfs fields exist when unavailable.
  • Implementation work: centralize memory snapshot collection, align columns with procps output, and decide which Linux-only fields are zero, omitted, or documented Windows approximations.
  • Probe plan: local shape probes for default and -h output. Validate header, Mem row, Swap row, numeric or human unit fields, and exit 0.

lsof

  • Upstream to inspect: lsof option parser, especially -i forms, no-header mode, and filtering syntax.
  • Current focus: fix attached short option argument form such as -iTCP:80 while preserving spaced form -i TCP:80.
  • Implementation work: teach the parser to split attached -i payloads before filter evaluation, then add tests for TCP, UDP, port-only, and malformed filters.
  • Probe plan: local shape/completes probes for --no-headers and -iTCP:80. Use compare_stdout=false because process/socket state is machine dependent.

man

  • Upstream to inspect: man-db src/man.c search order, section resolution, pager selection, and formatting fallback.
  • Current focus: WinuxCmd man is scoped to built-in command manuals, but should behave predictably for common commands and missing pages.
  • Implementation work: keep built-in manual lookup fast, add clear diagnostics for missing topics, and avoid invoking an interactive pager during non-TTY probes.
  • Probe plan: man ls or man grep should emit NAME, SYNOPSIS, and a command description shape. Missing topic should return the documented nonzero diagnostic.

top

  • Upstream to inspect: procps-ng top batch mode, version/help handling, iteration count, delay parsing, and output header fields.
  • Current focus: direct top.exe --version and top.exe -v are now owned by the standard dispatcher in 0.14.0; next release should add batch-mode behavioral probes.
  • Implementation work: verify -b -n 1 exits deterministically, make --rows stable, and keep interactive loop out of E2E probes.
  • Probe plan: top -b -n 1 --rows 5 shape probe for header and at least one process row, plus --version direct-entry regression.

tree

  • Upstream to inspect: upstream tree traversal order, -L depth limiting, summary counts, file/dir filtering, and Windows path display choices.
  • Current focus: release fixture already has a stable tree shape. Use it for depth-limited traversal and summary count checks.
  • Implementation work: ensure deterministic sorting, correct directory/file summary counts, and documented Unicode/ASCII branch output behavior.
  • Probe plan: tree -L 1 tree on benchmark fixture, checking root line, a few known child entries, and final directory/file count.

uptime

  • Upstream to inspect: procps-ng uptime.c default format, pretty mode -p, since mode -s, and load average handling.
  • Current focus: Windows has no Linux load average, so output should clearly preserve shape while using N/A or documented approximation.
  • Implementation work: centralize boot time calculation, validate pluralization and day/hour/minute formatting, and keep timestamp format stable.
  • Probe plan: local shape probes for default, -p, and -s. Regex-check time, up duration, load average fields, and YYYY-MM-DD HH:MM:SS since timestamp.

watch

  • Upstream to inspect: procps-ng watch.c option parser, title/no-title modes, interval/count behavior, command execution, and terminal refresh output.
  • Current focus: make finite non-interactive watch runs deterministic and avoid leaving live loops in tests.
  • Implementation work: verify count option naming and semantics, honor no-title, preserve child command exit handling, and isolate terminal clear/form-feed behavior.
  • Probe plan: watch -c 1 -t echo hi should complete, include hi, and exit 0. Add failing child command behavior after success path is stable.

Follow-up release checklist

  • Add or finish local-only probe support only when no fair reference executable is available.
  • Run Release build.
  • Run scripts/benchmark-command-parity.py with --fail-on-mismatch.
  • Run scripts/audit-command-compatibility.py.
  • Confirm commands_without_probe is 0 or document each remaining untestable command in the follow-up PR body.

Activity

  1. caomengxuan666 commented on Jul 31, 2026

    @caomengxuan666
    MemberAuthor

    Status update from the current compatibility PR:

    • scripts/benchmark-command-parity.py now supports local-only shape/performance probes via reference_required=False, so Windows/dynamic commands can record Winux timing without inventing a GNU/MSYS reference runtime.
    • Added Release benchmark probes for all eight commands: cpio, free, lsof, man, top, tree, uptime, and watch.
    • Refreshed generated evidence: current baseline is 240/240 passing probes, with the eight new dynamic probes marked as reference-not-required and reference_ms = null.
    • Refreshed the compatibility matrix: all non-local commands now have upstream LOC mapping, unit-test count, and performance-probe count. Remaining local command is tzset.

    Follow-up scope for this issue should now shift from “add first probe” to deeper source-led behavior parity:

    • cpio: harden list/extract and add archive list/extract E2E once reader bounds/crash paths are fixed.
    • free: align procps-ng column policy for -h, -t, -w, and Linux-only fields as documented Windows approximations.
    • lsof: finish attached -iTCP:80 / malformed-filter parser parity and add socket-filter probes.
    • man: decide whether to stay registry-scoped or add man-db-like section/topic diagnostics; current probe covers command index shape only.
    • top: fix -n/--iterations value parsing so top -b -n 1 --rows N exits normally instead of relying on capped prefix capture.
    • tree: expand depth/filter/count probes and document Unicode vs ASCII branch policy.
    • uptime: add -p and -s shape probes after centralizing boot-time/pluralization formatting.
    • watch: add failing-child/count/title behavior after the current finite no-title success probe.
  2. added
    enhancement
    on Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions