Skip to content

[bug] time keyword always prints the POSIX format ('real 0.00'): GNU default is leading blank line + tab-separated 'real 0m0.000s' (BASH_TIMEFORMAT) #268

Closed

Description

@caomengxuan666

Found by: wt5/audit source lane (2026-09-28), script-file-verified against WSL GNU Bash 5.3.0.

Summary: The time reserved word without -p must print GNU's default BASH_TIMEFORMAT — a LEADING blank line, TAB separators, and minute-form durations (real\t0m0.001s). rubash always prints the POSIX format (real 0.00\nuser 0.00\nsys 0.00), i.e. it behaves as if time -p were always in effect for the default case.

GNU C source owner: third_party/bash/execute_cmd.c:

  • :1244 #define POSIX_TIMEFORMAT "real %2R\nuser %2U\nsys %2S"
  • :1245 #define BASH_TIMEFORMAT "\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS"
  • :1552-1557 in print_time_info: posix_time ? POSIX_TIMEFORMAT : (TIMEFORMAT var ?: BASH_TIMEFORMAT) — the POSIX format only when time -p.

Reproducer (tests/fixtures/audit/a4-grammar.sh time section; raw: target/issue-suites/results/source-audit/out/a4-grammar.diff):

time true
TIMEFORMAT='%R'; time sleep 0
time -p true

GNU 5.3.0 stderr: per time true: blank line + real\t0m0.000s + user\t0m0.000s + sys\t0m0.000s; with TIMEFORMAT set prints the single %R number (honored); time -p true -> real 0.00 style.
rubash stderr: every default time prints the 3-line real 0.00 / user 0.00 / sys 0.00 block with no leading blank line and no tab/minute form; TIMEFORMAT itself is partially honored (%R single number printed).

Rubash owner: time-implementation in the executor (grep time -p / TimeFormat in src/executor).

Classification: rubash-caused. Output-format divergence visible to any script or test harness capturing time diagnostics.

Activity

  1. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    已修复并合入 master(commit 2c78889b,lane wt6/builtin2;GNU 引用与全矩阵验证见提交——回归 24/24、set-e/set-x/errors 真基线平价)。感谢报告!

  2. added
    bug
    area:builtins
    on Oct 17, 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

    area:builtinsbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions