df displays 0.

Tim Robbins tjr at FreeBSD.ORG
Mon Apr 14 03:33:40 PDT 2003


On Mon, Apr 14, 2003 at 12:05:16PM +0200, Christoph Kukulies wrote:

> 
> Is this normal?:
> 
> www# df
> Filesystem  1K-blocks     Used    Avail Capacity  Mounted on
> /dev/ad0s1a    257838    72384   164828    31%    /
> devfs               1        1        0   100%    /dev
> /dev/ad0s1e    257838       22   237190    0.%    /tmp
> /dev/ad0s1f  57829724 12064820 41138528    23%    /usr
> /dev/ad0s1d    257838     8686   228526     4%    /var
> 
> I mean, the 0. percent on /tmp .

This is probably another problem with vfprintf()'s new floating point code.
I'm seeing the same problem here now that I've rebuilt /bin/df with a recent
libc. Here's a test program that demonstrates the problem. It's worth pointing
out that 0.0 is printed correctly as "0%", but 0+eps is printed as "0.%".

#include <float.h>
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char *argv[])
{

	printf("%5.0f%%\n", 0.0);
	printf("%5.0f%%\n", DBL_EPSILON);
	exit(0);
}


More information about the freebsd-current mailing list