Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dd: open stdin from file descriptor when possible #4189

Merged
merged 2 commits into from
Mar 18, 2023

Commits on Mar 11, 2023

  1. dd: open stdin from file descriptor when possible

    Open stdin using its file descriptor so that a `dd skip=N` command in
    a subshell does not consume all bytes from stdin.
    
    For example, before this commit, multiple instances of `dd` reading
    from stdin and appearing in a single command line would incorrectly
    result in an empty stdin for each instance of `dd` after the first:
    
        $ printf "abcdef\n" | (dd bs=1 skip=3 count=0 && dd)  2> /dev/null
        # incorrectly results in no output
    
    After this commit, the `dd skip=3` process reads three bytes from the
    file descriptor referring to stdin without draining the remaining
    three bytes when it terminates:
    
        $ printf "abcdef\n" | (dd bs=1 skip=3 count=0 && dd)  2> /dev/null
        def
    jfinkels committed Mar 11, 2023
    Configuration menu
    Copy the full SHA
    9cb6b4a View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2023

  1. Configuration menu
    Copy the full SHA
    7a6092b View commit details
    Browse the repository at this point in the history