Skip to content

stdbuf: incorrect exit status when command can not be invoked #7072

@jfinkels

Description

@jfinkels

Environment: Ubuntu 20.04, uutils main branch (git commit 20b5365), GNU coreutils v8.30

Steps to reproduce:

$ stdbuf -o1 .

What happens now: with uutils stdbuf, the exit status is 1.

What I expected to happen: with GNU stdbuf, the exit status is 126.

Notes: this is causing a failure in the GNU test file tests/misc/stdbuf.sh.

For reference, the documentation for GNU stdbuf states

Exit status:

  • 125 if ‘stdbuf’ itself fails
  • 126 if COMMAND is found but cannot be invoked
  • 127 if COMMAND cannot be found
  • the exit status of COMMAND otherwise

Finally, for bonus points, the error message is slightly different. uutils says

stdbuf: failed to execute process: Permission denied

and GNU says

stdbuf: failed to run command ‘.’: Permission denied

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions