8000 dd: correct order and phrasing of truncated record by jfinkels · Pull Request #3154 · uutils/coreutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dd: correct order and phrasing of truncated record #3154

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

Merged
merged 1 commit into from
Feb 19, 2022

Conversation

jfinkels
Copy link
Collaborator

Place the "truncated records" line below the "records out" line in the
status report produced by dd and properly handle the singularization
of the word "record" in the case of 1 truncated record. This matches
the behavior of GNU dd.

For example

$ printf "ab" | dd cbs=1 conv=block status=noxfer > /dev/null
0+1 records in
0+1 records out
1 truncated record

$ printf "ab\ncd\n" | dd cbs=1 conv=block status=noxfer > /dev/null
0+1 records in
0+1 records out
2 truncated records

Place the "truncated records" line below the "records out" line in the
status report produced by `dd` and properly handle the singularization
of the word "record" in the case of 1 truncated record. This matches
the behavior of GNU `dd`.

For example

    $ printf "ab" | dd cbs=1 conv=block status=noxfer > /dev/null
    0+1 records in
    0+1 records out
    1 truncated record

    $ printf "ab\ncd\n" | dd cbs=1 conv=block status=noxfer > /dev/null
    0+1 records in
    0+1 records out
    2 truncated records
@jfinkels jfinkels force-pushed the dd-truncated-records branch from 54e60e0 to 766c85f Compare February 19, 2022 04:49
Comment on lines +786 to +790
match update.read_stat.records_truncated {
0 => {}
1 => eprintln!("1 truncated record"),
n => eprintln!("{} truncated records", n),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just amazing. It's clever but also extremely readable. I love it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust! I'm really enjoying using it 😄

@tertsdiepraam tertsdiepraam merged commit 1a7e5c4 into uutils:main Feb 19, 2022
@jfinkels jfinkels deleted the dd-truncated-records branch February 19, 2022 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0