NetBSD Problem Report #41541
From louis@shodo.berklee.net Thu Jun 4 17:29:07 2009
Return-Path: <louis@shodo.berklee.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 4F31263B11D
for <gnats-bugs@gnats.NetBSD.org>; Thu, 4 Jun 2009 17:29:07 +0000 (UTC)
Message-Id: <20090604161350.326BEFE08@shodo.berklee.net>
Date: Thu, 4 Jun 2009 12:13:50 -0400 (EDT)
From: lguillaume@berklee.edu
Reply-To: lguillaume@berklee.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: df -P is broken on netbsd-5
X-Send-Pr-Version: 3.95
>Number: 41541
>Category: bin
>Synopsis: df is broken with the -P option
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: mlelstv
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jun 04 17:30:00 +0000 2009
>Closed-Date: Sat Jun 20 06:54:32 +0000 2009
>Last-Modified: Sat Jun 20 06:54:32 +0000 2009
>Originator: Louis Guillaume
>Release: NetBSD 5.0_STABLE
>Organization:
>Environment:
System: NetBSD shodo.berklee.net 5.0_STABLE NetBSD 5.0_STABLE (GENERIC) #7: Fri May 1 18:09:20 EDT 2009 louis@shodo.berklee.net:/usr/obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
The df -P command is broken. For example, on this system:
$ df -Pk /
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/wd0a 4068920 953824 2911656 24% /
$ df -k /
Filesystem 1K-blocks Used Avail %Cap Mounted on
/dev/wd0a 508615 119228 363957 24% /
$ df -Pm /
df: non-standard block size incompatible with -P
Notice that the amounts are incorrect when using the -P option.
This problem does not happen on a netbsd-4 machine.
I'm quite sure the problem is with -P and not without it. But to be honest,
this is an assumption, as df is my only way of checking this now. And the
-m option to df fails with -P, so -P becomes suspect. df -Pm works on netbsd-4
as it does on other platforms (AIX, Darwin, Linux).
I tested on 2 different netbsd-5 machines and see the same problem.
>How-To-Repeat:
Try the df command with the -P option.
>Fix:
>Release-Note:
>Audit-Trail:
From: Michael van Elst <mlelstv@serpens.de>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/41541: df -P is broken on netbsd-5
Date: Thu, 4 Jun 2009 21:53:34 +0200
lguillaume@berklee.edu writes:
>
>The df -P command is broken. For example, on this system:
> $ df -Pk /
> Filesystem 1024-blocks Used Available Capacity Mounted on
> /dev/wd0a 4068920 953824 2911656 24% /
> $ df -k /
> Filesystem 1K-blocks Used Avail %Cap Mounted on
> /dev/wd0a 508615 119228 363957 24% /
See that the -P numbers are just multiplied by 8.
>This problem does not happen on a netbsd-4 machine.
The output of -P shows block counts scaled by f_bsize (block size) instead
of f_frsize (fundamental block size). However, the block counts are
defines as '(in units of f_frsize)'.
It also ignores reserved blocks.
This should fix both issues.
Index: df.c
===================================================================
RCS file: /cvsroot/src/bin/df/df.c,v
retrieving revision 1.83
diff -u -r1.83 df.c
--- df.c 20 Jul 2008 00:52:39 -0000 1.83
+++ df.c 4 Jun 2009 19:33:20 -0000
@@ -473,9 +473,9 @@
*/
(void)printf("%s %" PRId64 " %" PRId64 " %" PRId64 " %s %s\n",
sfsp->f_mntfromname,
- fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize),
- fsbtoblk(used, sfsp->f_bsize, blocksize),
- fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, blocksize),
+ fsbtoblk(sfsp->f_blocks, sfsp->f_frsize, blocksize),
+ fsbtoblk(used, sfsp->f_frsize, blocksize),
+ fsbtoblk(bavail, sfsp->f_frsize, blocksize),
availblks == 0 ? full : strpct64((uint64_t) used,
(uint64_t) availblks, 0), sfsp->f_mntonname);
/*
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."
Responsible-Changed-From-To: bin-bug-people->mlelstv
Responsible-Changed-By: mlelstv@NetBSD.org
Responsible-Changed-When: Sat, 06 Jun 2009 09:31:23 +0000
Responsible-Changed-Why:
I have a fix.
From: Michael van Elst <mlelstv@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41541 CVS commit: src/bin/df
Date: Sat, 6 Jun 2009 09:30:45 +0000
Module Name: src
Committed By: mlelstv
Date: Sat Jun 6 09:30:45 UTC 2009
Modified Files:
src/bin/df: df.c
Log Message:
block numbers are measured in f_frsize units. Make -P option
use this instead of f_bsize. Also account for reserved blocks
like normal non-P output.
Fixes PR bin/41541.
To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/bin/df/df.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->pending-pullups
State-Changed-By: mlelstv@NetBSD.org
State-Changed-When: Sun, 07 Jun 2009 08:42:11 +0000
State-Changed-Why:
[pullup-5 #797]
From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41541 CVS commit: [netbsd-5] src/bin/df
Date: Tue, 9 Jun 2009 17:35:39 +0000
Module Name: src
Committed By: snj
Date: Tue Jun 9 17:35:38 UTC 2009
Modified Files:
src/bin/df [netbsd-5]: df.c
Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #797):
bin/df/df.c: revision 1.86
block numbers are measured in f_frsize units. Make -P option
use this instead of f_bsize. Also account for reserved blocks
like normal non-P output.
Fixes PR bin/41541.
To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.83.4.1 src/bin/df/df.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: mlelstv@NetBSD.org
State-Changed-When: Sat, 20 Jun 2009 06:54:32 +0000
State-Changed-Why:
pullup to netbsd-5 done
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.