Skip to content

uname: add -A/--all-labeled, following GNU master - #13912

Merged
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:uname-A
Aug 15, 2026
Merged

uname: add -A/--all-labeled, following GNU master#13912
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:uname-A

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI lite review requested due to automatic review settings August 13, 2026 10:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GNU-compatible uname -A/--all-labeled output (one labeled item per line) to the uname utility, including CLI wiring, localized help/labels, and regression tests.

Changes:

  • Add -A/--all-labeled flag, plus labeled multi-line output formatting in uname.
  • Add new localization keys for the flag help text and output labels (en-US, fr-FR).
  • Add Rust tests for -A behavior and --all-labeled equivalence; update GNU fetch script to backport the corresponding GNU test.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
util/fetch-gnu.sh Adds GNU test backport entry and attempts to register backported tests in GNU build files.
tests/by-util/test_uname.rs Adds tests for -A output shape and --all-labeled parity with -A.
src/uu/uname/src/uname.rs Implements --all-labeled option, labeled output generation, and CLI flag wiring.
src/uu/uname/locales/en-US.ftl Adds help text and label strings for --all-labeled.
src/uu/uname/locales/fr-FR.ftl Adds French help text and label strings for --all-labeled.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread util/fetch-gnu.sh
Comment thread src/uu/uname/src/uname.rs
Comment on lines +77 to +81
let Some(value) = value else { continue };
out.push(translate!(label));
out.push(": ");
out.push(value);
out.push("\n");
@codspeed-hq

codspeed-hq Bot commented Aug 13, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 350 untouched benchmarks
⏩ 50 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation ls_recursive_deep_tree[(200, 2)] 3.5 ms 3.6 ms -4.46%
Simulation complex_relative_date 330.6 µs 318.4 µs +3.83%
Simulation cp_recursive_wide_tree[(6000, 800)] 388.4 ms 376.6 ms +3.14%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing sylvestre:uname-A (8185482) with main (a56bff2)

Open in CodSpeed

Footnotes

  1. 50 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copilot AI review requested due to automatic review settings August 13, 2026 20:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (3)

util/fetch-gnu.sh:24

  • sed -i plus \n and \t in the replacement string is GNU-sed-specific; on BSD/macOS sed this commonly fails or inserts literal n/t, which can corrupt all_tests and break make check. Consider switching this block to a more portable insertion approach (e.g., a small Perl/Python edit, or a POSIX-sed-compatible multiline insert), and avoid relying on \t escape handling in sed replacements.
# A test that does not exist in $ver at all is absent from its test list, so
# `make check` would silently never run it.  Register those in both the automake
# input and the generated Makefile.in: configure derives Makefile from the
# latter, and build-gnu.sh deliberately keeps automake from re-running.
for f in "${backport[@]}"; do
  grep -qF "tests/$f" tests/local.mk ||
    sed -i "s|^all_tests =.*|&\n  tests/$f\t\t\t\t\\\\|" tests/local.mk
  grep -qF "tests/$f" Makefile.in ||
    sed -i "s|^all_tests =.*|&\n  tests/$f\t\t\t\t\\\\|" Makefile.in
done

src/uu/uname/src/uname.rs:79

  • The output punctuation/spacing (": ") is hardcoded in code rather than localized. This makes locale-specific typography impossible (e.g., French commonly uses a space before :) and forces all locales into the same formatting. A more maintainable approach is to include the separator/format in the localized string (e.g., make labels include : / spacing, or use a single localized format string that takes { label } and { value }).
            out.push(translate!(label));
            out.push(": ");
            out.push(value);
            out.push("\n");

tests/by-util/test_uname.rs:154

  • This test asserts English label text even though the implementation uses localized strings (translate!(...)). If the test runner environment ever selects a non-English locale, this becomes brittle. To make the test deterministic, consider forcing the locale for the invoked command (e.g., set LC_ALL=C/LANG=en_US.UTF-8 via the test command builder) or asserting against non-localized invariants (like line count + presence of values) rather than specific translated labels.
fn test_uname_all_labeled() {
    let result = new_ucmd!().arg("-A").succeeds();
    let stdout = result.stdout_str();
    // One labeled "Label: value" line per item. Like GNU, an unknown processor or
    // hardware platform is omitted, and we never determine either one.
    assert_eq!(stdout.lines().count(), 6);
    for label in [
        "Kernel name: ",
        "Node name: ",
        "Kernel release: ",
        "Kernel version: ",
        "Machine: ",
        "Operating system: ",
    ] {
        assert!(stdout.contains(label), "missing {label:?}");
    }

@github-actions

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 149.04 MB (-64 KB, -0.04%)

Significant per-binary changes:
  [           1.10 MB ->    1.18 MB  (+76 KB, +6.74%)
  mkfifo      1.09 MB ->    1.16 MB  (+76 KB, +6.81%)
  test        1.10 MB ->    1.18 MB  (+76 KB, +6.74%)
  install     1.25 MB ->    1.32 MB  (+72 KB, +5.62%)
  mkdir       1.10 MB ->    1.17 MB  (+72 KB, +6.38%)
  mknod       1.10 MB ->    1.17 MB  (+72 KB, +6.41%)
  chmod       1.15 MB ->    1.22 MB  (+68 KB, +5.76%)

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/retry (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/printf/printf-surprise is now being skipped but was previously passing.
Congrats! The gnu test tests/csplit/csplit-heap is now passing!

@sylvestre
sylvestre merged commit b7a7b40 into uutils:main Aug 15, 2026
170 of 171 checks passed
@sylvestre
sylvestre deleted the uname-A branch August 15, 2026 07:20
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.

2 participants