From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 2 10:33:33 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id A2C96106566C; Fri, 2 Mar 2012 10:33:33 +0000 (UTC) Date: Fri, 2 Mar 2012 10:33:33 +0000 From: Alexander Best To: Jason Hellenthal Message-ID: <20120302103333.GA88008@freebsd.org> References: <20120301233822.GA19709@freebsd.org> <20120302063659.GB31588@DataIX.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120302063659.GB31588@DataIX.net> Cc: freebsd-hackers@freebsd.org Subject: Re: small change to du, so it will accepts unit suffixes for negative thresholds X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Mar 2012 10:33:33 -0000 On Fri Mar 2 12, Jason Hellenthal wrote: > > > On Thu, Mar 01, 2012 at 11:38:22PM +0000, Alexander Best wrote: > > hi there, > > > > i just noticed that du will not accepts something like the following: > > > > du -t-500M > > > > whereas > > > > du -t500M > > > > will work. i've attached a patch, which makes unit suffixes in connection with > > negative thresholds possible. > > > > I don't get it. I just ran both instances of what you have above without > your patch on 8-STABLE i386 and both work as intended. Are you seeing > something I am not ? you are right. there seems to have been a du change between 8-STABLE and HEAD, or maybe even in expand_number(). when i run 'du -t-500M /' on HEAD i get: du: invalid threshold: -500M usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] [-a | -s | -d depth] [-B blocksize] [-I mask] [-t threshold] [file ...] ... i'll investigate some more. i also found that on 8-STABLE du isn't working properly in all cases. try the following: mkdir empty ; cd empty ; mkdir empty2 running 'du -t-1M' should report empty2, but it doesn't. running 'du -t-2M' does. according to 'ls -la' an empty directory is 4096 byte. so 'du -t-4097' should report the empty dir; however it doesn't. du seems to quite broken when it comes to the -t option. have a look at the following: mkdir empty3; cd empty3; du -h -t1M reports 2,0k . that's completely wrong, since i instructed du to only display entries > 1 megabyte. cheers. alex > > -- > ;s =;