From owner-freebsd-stable@FreeBSD.ORG Tue Sep 19 16:17:56 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5337516A47B for ; Tue, 19 Sep 2006 16:17:56 +0000 (UTC) (envelope-from csjp@FreeBSD.org) Received: from ems01.seccuris.com (ems01.seccuris.com [204.112.0.35]) by mx1.FreeBSD.org (Postfix) with SMTP id CC1EB43D69 for ; Tue, 19 Sep 2006 16:17:54 +0000 (GMT) (envelope-from csjp@FreeBSD.org) Received: (qmail 48430 invoked by uid 86); 19 Sep 2006 16:55:30 -0000 Received: from unknown (HELO ?127.0.0.1?) (204.112.0.40) by ems01.seccuris.com with SMTP; 19 Sep 2006 16:55:30 -0000 Message-ID: <45101832.7010009@FreeBSD.org> Date: Tue, 19 Sep 2006 11:17:54 -0500 From: "Christian S.J. Peron" User-Agent: Thunderbird 1.5.0.7 (Macintosh/20060909) MIME-Version: 1.0 To: Andriy Gapon References: <45101281.7090508@icyb.net.ua> In-Reply-To: <45101281.7090508@icyb.net.ua> Content-Type: multipart/mixed; boundary="------------000507050408010505060703" Cc: freebsd-stable@freebsd.org Subject: Re: df -kP != df -Pk X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Sep 2006 16:17:56 -0000 This is a multi-part message in MIME format. --------------000507050408010505060703 Content-Type: text/plain; charset=KOI8-U; format=flowed Content-Transfer-Encoding: 7bit Andriy Gapon wrote: > It seems that -P flag to df resets previously specified -k for no good > reason. POSIX expressly talks about -P and -k being used together. > http://www.opengroup.org/onlinepubs/009695399/utilities/df.html > > This is FreeBSD 6.1-RELEASE-p2 i386. > > Please test the attached patch and let me know if it's good for you. Thanks for bringing this to our attention. -- Christian S.J. Peron csjp@FreeBSD.ORG FreeBSD Committer FreeBSD Security Team --------------000507050408010505060703 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="df.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="df.c.diff" ? df ? df.1.gz ? df.c.diff Index: df.c =================================================================== RCS file: /home/ncvs/src/bin/df/df.c,v retrieving revision 1.64 diff -u -r1.64 df.c --- df.c 10 Jan 2005 08:39:21 -0000 1.64 +++ df.c 19 Sep 2006 16:14:37 -0000 @@ -93,7 +93,7 @@ return (a > b ? a : b); } -static int aflag = 0, cflag, hflag, iflag, nflag; +static int aflag = 0, cflag, hflag, kflag, iflag, nflag, Pflag; static struct ufs_args mdev; int @@ -123,6 +123,7 @@ case 'b': /* FALLTHROUGH */ case 'P': + Pflag++; putenv("BLOCKSIZE=512"); hflag = 0; break; @@ -143,6 +144,7 @@ iflag = 1; break; case 'k': + kflag++; putenv("BLOCKSIZE=1k"); 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"); mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); bzero(&maxwidths, sizeof(maxwidths)); for (i = 0; i < mntsize; i++) --------------000507050408010505060703--