Skip to content

dd incorrectly depends on fcntl syscall #12157

Open

Description

@oech3
$ strace -o /dev/null -e inject=fcntl:error=ENOSYS dd if=/etc/pacman.conf
dd: write error
$ strace -o /dev/null -e inject=fcntl:error=ENOSYS '/home/a/bin/gnu9.11/dd' if=/etc/pacman.conf # success

I guess this bug was introduced at #10235
@svlv @ChrisDryden

Activity

  1. xtqqczze commented on May 5, 2026

    @xtqqczze
    Collaborator

    Could you explain a bit more about why it is incorrect?

  2. oech3 commented on May 5, 2026

    @oech3
    ContributorAuthor

    Because GNU success with the provided command.

  3. oech3 commented on May 5, 2026

    @oech3
    ContributorAuthor

    Is it easy to remove try_clone?
    But this is low priority since this would affect to very few containers.

    Rust std should really stop force-breaking stdout and signals by default...

  4. oech3 commented on May 7, 2026

    @oech3
    ContributorAuthor

    I guess we cannot use rustix::stdio::stdout at here since dd requires seek.

  5. xtqqczze commented on May 7, 2026

    @xtqqczze
    Collaborator

    The usual pattern would be to use a "borrowed" File:

    let mut file = ManuallyDrop::new(unsafe { File::from_raw_fd(raw_fd) });
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions