heim
heim copied to clipboard
Disk information returns an error on a LUKS-encrypted Void Linux installation
It appears that there are use cases where users who are using encrypted drives in Linux will be unable to get some disk statistics.
This can reproduced by trying to run the disk_usage example from the repo, which results in this error message when trying to access some disks:

Running with sudo does work, however:

For me, I would assume this would work even without sudo. If this is expected behaviour, feel free to close.
Quick disclaimer, I didn't find this bug, it originally caught in this report: https://github.com/ClementTsang/bottom/issues/419
Was doing some more digging, the crash in the example is probably coming from the .usage() line.
Hey, @ClementTsang!
Yeah, your bottom patch is what should be done here: it is expected to have PermissionDenied error if process owner does not have enough rights to query information about filesystem, in this case you are hitting EACCES from the statvfs function.
I was assuming that returning Result from the usage() function would be enough, but do you think I should also add more documentation that caller should expect to receive some particular error kinds and handle them gracefully?
Firstly, yeah, the issue on my side with the original bug report was on me, I handled the errors in a bit of a weird way (abusing the ? syntax) and got bitten by it. Oops.
do you think I should also add more documentation that caller should expect to receive some particular error kinds and handle them gracefully?
Off the top of my head, that sounds pretty helpful. At least personally, I kinda treat the library as a bit of a black box in many cases, so I guess some documentation on what errors the given implementation might return would make for a bit less head-scratching in some cases.