houkouonchi - 方向音痴 Nov 14, 2012 @ 12:50am
[Bug] _FILE_OFFSET_BITS=64 needed for large file-systems in 32-bit applications
Right now disk space detection is not working correctly for anyone with > 2 TiB of free space. Since it is 32-bit it needs to be compiled with _FILE_OFFSET_BITS=64 or some other method to insure larger file-size's/filesystems still work.

When ran on a file-system with a lot of free space disk-space can't be calculated and thus things don't work properly. See screenshot:

http://box.houkouonchi.jp/steam_bug.png

Erroring when the file-system ha >7TB free of disk space.

Here is an example code:

using code btags appears to be broken on this forum so example code here:

http://box.houkouonchi.jp/diskstat.c

On 64-bit this works just fine:

dekabutsu ~ # gcc -o diskstat diskstat.c 2> /dev/null
dekabutsu ~ # file diskstat
diskstat: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), for GNU/Linux 2.6.16, dynamically linked (uses shared libs), not stripped
dekabutsu ~ # ./diskstat /data
Disk /data:
block size: 4096
total no blocks: 2081576350
free blocks: 1656929874
dekabutsu ~ #

However on 32-bit it does not:

dekabutsu ~ # gcc -o diskstat diskstat.c 2> /dev/null
dekabutsu ~ # file diskstat
diskstat: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
dekabutsu ~ # ./diskstat /data
Failed to stat /data:
dekabutsu ~ #

Compiling with _FILE_OFFSET_BITS=64 fixes the problem:

dekabutsu ~ # gcc -D _FILE_OFFSET_BITS=64 -o diskstat diskstat.c 2> /dev/null
dekabutsu ~ # file diskstat
diskstat: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
dekabutsu ~ # ./diskstat /data
Disk /data:
block size: 4096
total no blocks: 2081576350
free blocks: 1656929870
dekabutsu ~ #

I am sure lots of other ways you can fix it if you want to explicitly set it in the code as well. But please fix this as its a pretty serious bug.

The other option is of course release a 64-bit compiled binary.
Last edited by houkouonchi - 方向音痴; Nov 14, 2012 @ 12:55am
Showing 1-4 of 4 comments
< >
mikeym Nov 14, 2012 @ 1:50am 
That's some filesystem you have there houkouonchi.
ThOR27 Nov 14, 2012 @ 2:31am 
Damn. And I tough my 1TB disk was huge.
johndrinkwater [🐧︀ 🎮] Nov 14, 2012 @ 3:49am 
+1 for research and disk size.
SCIBOTIC Nov 14, 2012 @ 6:53am 
Bumping a useful bug report.
Showing 1-4 of 4 comments
< >
Per page: 15 30 50
Date Posted: Nov 14, 2012 @ 12:50am
Posts: 4