Skip to content

jobs listing format + subshell spacing (batch88)#294

Merged
brianjfox merged 2 commits into
mainfrom
fix/testsuite-batch88
Jul 25, 2026
Merged

jobs listing format + subshell spacing (batch88)#294
brianjfox merged 2 commits into
mainfrom
fix/testsuite-batch88

Conversation

@brianjfox

Copy link
Copy Markdown
Owner

Summary

Two related formatting fixes (jobs 83 → 67, comsub2 35 → 27, zero regressions).

1. jobs listing format

The jobs listing diverged from bash in three ways:

  • the status field was padded to 22 columns instead of bash's 27 (LONGEST_SIGNAL_DESC);
  • every job was marked + instead of + for the current job, - for the previous, and a space otherwise;
  • a running background job was missing its trailing &.

Now pads the status to 27, marks the two most recently started jobs +/- (an approximation of bash's current/previous job), and appends & to a running background job.

2. subshell spacing

The single-line AST printer emitted (list) without the spaces bash uses. Emit ( list ) to match bash's deparser (the multi-line function pretty-printer already spaced it). This also fixed subshells inside command substitutions, hence the comsub2 improvement.

[1]   Running                    sleep 5 &
[2]-  Running                    sleep 5 &
[3]+  Running                    ( sleep 2; exit 4 ) &

Testing

  • ctest 22/22
  • Scoreboard: jobs 83 → 67, comsub2 35 → 27, zero regressions across the full suite
  • Verified listing width/markers/ & and subshell rendering (jobs, declare -f, type, trap) against bash 5.3

Closes #293.

The `jobs' listing diverged from bash in three ways: the status field was
padded to 22 columns instead of bash's 27 (LONGEST_SIGNAL_DESC); every job was
marked `+' instead of `+' for the current job, `-' for the previous, and a
space otherwise; and a running background job was missing its trailing ` &'.

Pad the status to 27, mark the two most recently started jobs `+'/`-' (an
approximation of bash's current/previous job), and append ` &' to a running
background job.

Closes #293.
The single-line printer emitted `(list)' without the spaces bash uses, so job
listings and command substitutions containing a subshell (`( sleep 2; exit 4 )')
rendered differently from bash.  Emit `( list )', matching bash's deparser (the
multi-line function pretty-printer already spaced it).
@brianjfox
brianjfox merged commit f58352d into main Jul 25, 2026
1 check passed
@brianjfox
brianjfox deleted the fix/testsuite-batch88 branch July 25, 2026 02:38
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.

jobs listing format: wrong status width, missing +/- markers and trailing &

1 participant