Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2000 16:19:07 +0200
From:      Peter Pentchev <roam@orbitel.bg>
To:        Sheldon Hearn <sheldonh@uunet.co.za>
Cc:        arch@freebsd.org
Subject:   Re: add -I ignoremask option to du(1)
Message-ID:  <20001214161907.D369@ringworld.oblivion.bg>
In-Reply-To: <55313.976800156@axl.fw.uunet.co.za>; from sheldonh@uunet.co.za on Thu, Dec 14, 2000 at 03:22:36PM %2B0200
References:  <20001214034803.C575@ringworld.oblivion.bg> <55313.976800156@axl.fw.uunet.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 14, 2000 at 03:22:36PM +0200, Sheldon Hearn wrote:
> 
> 
> On Thu, 14 Dec 2000 03:48:04 +0200, Peter Pentchev wrote:
> 
> > Is there a reason no one has done this yet? :)
> 
> I think we're getting totally out of hand with respect to teaching
> utilities how to do each others' jobs for one another.

I'm aware that danger lieth along that path.  However, see below.

> Recursion, exclusion and pattern matching are all creeping into
> utilities that once did one job well.  These things are all handled very
> well by find and the shell.

In general, I agree.  However, consider the problem at hand: getting
information about the filesystem usage of files and directories down
a tree, excluding certain files.  Let's consider an example when all
files and directories matching either of '*.c' and 'CVS' patterns need
to be excluded.

I mentioned in my first email that this could be done through some find(1)
hackery.  I can see several possible problems there - feel free to correct
my admittedly not-thoroughly-informed opinions on any of those.

1. Non-obvious syntax.  OK, I'll admit that this was the main reason -
   I was almost stumped when I had to find out how to do it :)  And I am
   still somewhat doubtful as to whether I have really found a way.
   The best I've come up with so far is:

   find path ( ( -name *.c -or -name CVS ) -and -prune ) -or -print

   or -ls instead of -print.

   With -print, du(1) descends directories, showing space allocated
   to ignored files, too.  With -ls, I can easily awk out the filesize
   and name, but I'd have to do additional scripting to keep track of
   directory tree totals.

2. With find(1) and du(1) combined, there might be a heavy duplication
   of effort involved - traversing a directory tree twice.  This does
   not happen with find -ls | awk, but see above for the directory tree
   totals :(

3. I'd think the fts routines that du(1) uses could be more efficient
   than having find(1) pass its output through (possibly blocking) pipes
   to whatever happens to be on the other end.  Note that this is a
   *highly* uninformed opinion though, and I should probably not be
   mentioning it at all :)

> So the only question is whether we shrug and continue down this road, or
> limit ourselves to only those silly enhancements that we deem necessary
> for compatibility with other platforms.

As I mentioned above, I agree in principle; just not in this particular
case.  This might very well turn into creeping featurism (which I know
will not be allowed :), but I like telling myself that it's not all
that bad :)

G'luck,
Peter

-- 
I am the thought you are now thinking.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001214161907.D369>