[Fwd: Re: df -kP != df -Pk]

Toby Peterson toby at apple.com
Wed Sep 20 13:34:48 PDT 2006


On 20 September 2006, at 01.04.42, Bruce Evans wrote:

> On Tue, 19 Sep 2006, Christian S.J. Peron wrote:
>
>> Anyone have any objections to me committing this patch?
>
> % @@ -123,6 +123,7 @@
> %  		case 'b':
> %  				/* FALLTHROUGH */
> %  		case 'P':
> % +			Pflag++;
>
> Why not just "if (kflag) break;" here?
>
> %  			putenv("BLOCKSIZE=512");
> %  			hflag = 0;
> %  			break;
> % @@ -171,6 +173,12 @@
> %  	argc -= optind;
> %  	argv += optind;
> % % +	/*
> % +	 * POSIX specifies that if both -P and -k options are used  
> together a
> % +	 * 1k blocksize should be used.
> % +	 */
> % +	if (Pflag != 0 && kflag != 0)
> % +		putenv("BLOCKSIZE=1k");
>
> Then this would not be needed (except for the comment).
>
> POSIX actually requires BLOCKSIZE to be set to 1024, not to 1k, so  
> that the
> header says 1024 and not 1k.  df -k causes the wrong output now and  
> the
> above preserves this bug.

This is essentially what our (Apple's) patches to df do. -P does  
nothing if -k is set, and -k sets BLOCKSIZE=1024.

- Toby


More information about the freebsd-standards mailing list