Android 12: df
fix integer overflow in computation of Total
row
#6070
Labels
df
fix integer overflow in computation of Total
row
#6070
I create this issue from a finding from pullrequest #5821.
When running tests of uutils
df
on my own android phone (not on AVD),they are failing due to integer overflow:
The fix that I'm working on in PR #5821 can handle this and the result is:
One can see that some entries (of type erofs) report inodes number at exactly (or close to) 18446744073709551615 which is the maximum number a
u64
can represent.I also tested the GNU implementation for this (on a erofs on my ubuntu) and it turned out that GNU also is not handling it porperly. It does a silent integer (u64) overflow in this case.
Therefor my proposal is to use a u128 for the total sum of inodes. I know that this is slower than u64 as its probably not natively supported, but we are not accululating millions of numbers such that it should not be significant.
I will continue working on it and provide a seperate PR to #5821
The text was updated successfully, but these errors were encountered: