Skip to content

du: don't panic on block-size 0 #7742

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
Apr 12, 2025

Conversation

BenWiederhake
Copy link
Collaborator

@BenWiederhake BenWiederhake commented Apr 12, 2025

$ cargo run du -B0
     Running `target/debug/coreutils du -B0`

thread '<unnamed>' panicked at src/uu/du/src/du.rs:551:26:
attempt to divide by zero
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
du: sending on a closed channel
[$? = 1]

I think that's a new record for fewest characters needed to cause a panic :D

This PR fixes the panic, and adds a test to ensure we don't regress.

This addresses only part of #7738.

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)

@sylvestre sylvestre merged commit 689aaf9 into uutils:main Apr 12, 2025
69 checks passed
@BenWiederhake BenWiederhake deleted the dev-du-block-size-0 branch April 12, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants