Skip to content

many utils: cmd arg >&- should not silently success #9795

Open

Description

@oech3

After some talk with @pixelb about help-version*.sh uutils disabled to avoid large logs, I noticed that we have

$ uu-true --version >&- # success
$ gnu-true --version >&-
true: write error: Bad file descriptor
$ ls >&- # success
$ gnu-ls >&-
ls: write error: Bad file descriptor

Related: #9782 #9769

Activity

  1. collinfunk commented on Dec 23, 2025

    @collinfunk

    Likewise with the SIGPIPE issue, I do not think this can be solved without the help of Rust itself. They decide to open standard file descriptors that have been closed before main [1].

    [1] https://github.com/rust-lang/rust/blob/main/library/std/src/sys/pal/unix/mod.rs#L54

  2. ChrisDryden commented on Dec 23, 2025

    @ChrisDryden
    Collaborator

    @collinfunk I have an approach here that solves the issue until it can be addressed by rust itself: https://github.com/uutils/coreutils/pull/9664/changes#diff-0cb7b16878f5d3cd1c3e444e45a4b09c151b450c98f227ec29c197cc75ca2f5fR429 is the solution implemented here any different in end outcome than having it addressed by Rust?

  3. ChrisDryden commented on Dec 23, 2025

    @ChrisDryden
    Collaborator

    the approach of using the data_init reading of the signals for stdin stdout and stderr, can also be applied to the sigpipe issue: https://github.com/uutils/coreutils/pull/9657/changes#diff-0cb7b16878f5d3cd1c3e444e45a4b09c151b450c98f227ec29c197cc75ca2f5fR429

  4. oech3 commented on Dec 24, 2025

    @oech3
    ContributorAuthor
  5. changed the title [-]many utils: cmd arg >&- should fail with write error: Bad file descriptor instead of silent success[/-] [+]many utils: cmd arg >&- should not silently success[/+] on Dec 25, 2025
  6. sylvestre commented on Nov 17, 2026

    @sylvestre
    SponsorContributor

    This is what makes the GNU test misc/io-errors fail (every GnuTests run, ~140 cases). To run it: bash util/build-gnu.sh && bash util/run-gnu-test.sh tests/misc/io-errors.sh

  7. oech3 commented on Nov 21, 2026

    @oech3
    ContributorAuthor

    Please don't use std*_was_closed at new PR. I'll deprecate them after #16299 . Also new version of Rust std allows to drop the rustix::iohack too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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