greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.88k stars 475 forks source link

Compilation error / overflows with disk_usage block on i686 #88

Closed ixeft closed 6 years ago

ixeft commented 7 years ago

Hello,

Trying to compile on a Archlinux i686 - Intel Atom Z520

I got a compilation error on this file https://github.com/greshake/i3status-rust/blob/master/src/blocks/disk_space.rs

error[E0308]: mismatched types --> src/blocks/disk_space.rs:177:45 | 177 | result = statvfs.f_bavail * statvfs.f_bsize; | ^^^^^^^^^^^^^^^ expected u64, found u32

using "as u64" I got the code compiling but now, with path bigger than 4Gio, I got an overflow getting wrong value of statvfs.f_bfree / statvfs.f_bsize (crazy big values)

Using glibc in C/C++ I would define _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE to solve this problem.

Since I didn't saw any way of doing that using nix-rust, I reported the bug there, anyway @Susurrus suggested that :

We just wrap the statvfs strict provided by libc. This is likely an issue with the type as it's declared there. Please open and issue there to discuss this and link back to this one.

Here is the nix-rust issue https://github.com/nix-rust/nix/issues/743

Any Idea of how to correct that (If so, I can provide a pull request) ?

Regards

(However, I'm fine, since I have 13944733703.25GiB available on my disk ;) )

svmnotn commented 7 years ago

seems like the issue was in https://github.com/rust-lang/libc, @ixeft could you add a comment here whenever nix updates it's libc dependency with the fix?

atheriel commented 6 years ago

This is very likely fixed with long-since-updated dependencies.