1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

df: Fix calculation of Use% in "total" row

Change formula from: "Used/Size * 100" to "Used/(Used + Avail) * 100".
This formula also works if "Used" and "Avail" do not add up to "Size",
which is the case if there are reserved disk blocks.
This commit is contained in:
Daniel Hofstetter 2022-04-01 08:25:30 +02:00
parent bed7dc5a29
commit bf69c63e09
2 changed files with 8 additions and 4 deletions

View file

@ -140,7 +140,7 @@ fn test_total() {
#[test]
fn test_use_percentage() {
let output = new_ucmd!()
.args(&["--output=used,avail,pcent"])
.args(&["--total", "--output=used,avail,pcent"])
.succeeds()
.stdout_move_str();