Skip to content

Conversation

@bkuzma-nowaera
Copy link

No description provided.

DrHyde added a commit to DrHyde/configurations that referenced this pull request Dec 20, 2025
There's a PR to add NetBSD support, which builds, but gives the wrong results:
  muesli/duf#331
@DrHyde
Copy link

DrHyde commented Dec 20, 2025

While the code in this PR builds on NetBSD it gives incorrect results:

$ ./duf --only local --style ascii
+-------------------------------------------------------------------------------------+
| 1 local device                                                                      |
+------------+-------+-------+-------+----------------------------+------+------------+
| MOUNTED ON |  SIZE |  USED | AVAIL |            USE%            | TYPE | FILESYSTEM |
+------------+-------+-------+-------+----------------------------+------+------------+
| /          | 58.2G | 24.4G | 30.8G | [########..........] 42.0% | ffs  | /dev/dk0   |
+------------+-------+-------+-------+----------------------------+------+------------+

$ df -h /
Filesystem     Size   Used  Avail %Cap Mounted on
/dev/dk0       7.3G   3.1G   3.9G  44% /

This is with NetBSD 10.1 on i386 (32-bit, not 64-bit), built using Go 1.25.2.

I find it deeply suspicious that the size/used/avail figures are all off by approximately a factor of 8 - and the "approximately" could easily be a result of rounding. Is the underlying block size not being retrieved correctly?

According to sys/statvfs.h blocks, bfree, bavail are in units of frsize not bsize.
@bkuzma-nowaera
Copy link
Author

According to sys/statvfs.h blocks, bfree, bavail are in units of frsize not bsize.

@DrHyde
Copy link

DrHyde commented Dec 26, 2025

Thanks, with that patch I get the right results

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