Skip to content

Wrapper applets eat the wrapped command's options: stdbuf -oL ls -l and time ls -l fail with 'invalid option -- l', runcon misreads it as its own missing argument; chroot/runcon option errors exit 1 instead of GNU's 125 #1375

Closed

Description

@caomengxuan666

Probe-verified residuals of audit item O5 (same-source mingw+Wine harness, two runs, GNU coreutils 9.4). The "wrapper" applets — commands whose operands include a whole command line — do not stop their own option parsing at the wrapped command, and their usage-error exit codes ignore the coreutils 125 convention. (env's stop-policy is already #1353 and timeout's missing -s/-k flags are #1359/#1355 territory; the faces below are the unfiled remainder.)

  1. stdbuf eats the wrapped command's options. stdbuf -oL ls -l → WinuxCmd: stdbuf: invalid option -- 'l', exit 125, nothing runs. GNU runs ls -l. (The attached-value form stdbuf -e0 ... happens to work; a separate-token option of the wrapped command does not.)
  2. time eats the wrapped command's options. time ls -l → WinuxCmd: time: invalid option -- 'l', exit 1. GNU runs ls -l and reports timings.
  3. runcon eats the wrapped command's options. runcon ctx ./ls.exe -l → WinuxCmd: runcon: option requires an argument -- 'l' — it claims runcon's own option -l is missing its argument; the wrapped command never runs.
  4. Exit codes. chroot --zzz root → WinuxCmd exit 1; GNU exit 125. runcon --zzz ctx ... → WinuxCmd exit 1; GNU exit 125. (Missing-operand chroot with no arguments does exit 125 on both — the mapping exists but is not applied to option errors.)

Expected (GNU)

Once the wrapped command starts, its argv passes through untouched (coreutils' stop-at-first-nonoption / -- discipline per tool), and usage errors in this applet family exit 125.

Source

src/core/command_context.cppm: stop_options_after_positionals-style policy is missing or not applied for stdbuf/time/runcon; the exit-status mapping used by these applets defaults option errors to 1 instead of EXIT_USAGE (125).

Regression seed

In-repo tests named with this issue number: the four probes above, asserting the wrapped command actually runs (faces 1–3) and exit code 125 (face 4).

Activity

  1. added
    bug
    compat-gap
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugcompat-gap

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions