public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Etaoin Shrdlu <shrdlu@unlimitedmail.org>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Finding orphaned libs
Date: Tue, 9 Jun 2009 17:20:49 +0200	[thread overview]
Message-ID: <200906091720.49610.shrdlu@unlimitedmail.org> (raw)
In-Reply-To: <20090609153635.41a07c5b@zaphod.digimed.co.uk>

On Tuesday 9 June 2009, 16:36, Neil Bothwick wrote:
> On Tue, 09 Jun 2009 16:15:21 +0200, Joerg Schilling wrote:
> > > find -H /usr/lib /lib -type f | xargs -d'\n' qfile --orphans
> >
> > No, this is definitely wrong: the right way to handle this is
> > execplus (since 19 years).
>
> If it's been around 19 years, why doesn't Google know anything about
> it? What is it?

Well, google does not know everything :)

Basically, using + instead of ; after -exec allows to run the specified 
command less times, each time with the highest possible number of 
arguments (instead of running it once per file, which is what happens 
with ;). And yes, that's been in POSIX for a long time now. Example:


$ ls
file1  file2  file3  file4  file5

$ find . -type f -exec sh -c 'echo "number of arguments: $#"' sh {} \;
number of arguments: 1
number of arguments: 1
number of arguments: 1
number of arguments: 1
number of arguments: 1

$ find . -type f -exec sh -c 'echo "number of arguments: $#"' sh {} +
number of arguments: 5

So when you have to run a command on a very big number of files, say 1000 
or more, with ; you spawn 1000 processes, with + you span just one or 
two (well, depending on the maximum command line length on the system 
anyway). This is of course much less resource intensive.

Basically, using -exec with + does what xargs does, but without the need 
to care for strange characters in file names (well, a bit simplified, 
but you get the idea).



  parent reply	other threads:[~2009-06-09 15:04 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 20:44 [gentoo-user] Finding orphaned libs Alan McKinnon
2009-06-08 20:54 ` Neil Bothwick
2009-06-08 22:10   ` Alan McKinnon
2009-06-08 22:57     ` Dale
2009-06-08 23:31   ` Willie Wong
2009-06-09 10:05     ` Joerg Schilling
2009-06-09 10:54       ` Neil Bothwick
2009-06-08 23:52   ` Dale
2009-06-09  0:18     ` Willie Wong
2009-06-09  0:27       ` Dale
2009-06-09  7:03         ` Alan McKinnon
2009-06-09 13:01         ` Mike Kazantsev
2009-06-10  7:53           ` Dale
2009-06-10  8:37             ` Mike Kazantsev
2009-06-09 13:33   ` Volker Armin Hemmann
2009-06-09 13:48     ` Joerg Schilling
2009-06-09 14:04       ` Volker Armin Hemmann
2009-06-09 14:34         ` Neil Bothwick
2009-06-09 14:51           ` Joerg Schilling
2009-06-09 14:08       ` Mickaël Bucas
2009-06-09 14:15         ` Joerg Schilling
2009-06-09 14:36           ` Neil Bothwick
2009-06-09 14:42             ` Paul Hartman
2009-06-09 14:52               ` Neil Bothwick
2009-06-09 14:59                 ` Joerg Schilling
2009-06-09 15:29                   ` Neil Bothwick
2009-06-09 15:21                 ` Etaoin Shrdlu
2009-06-09 15:28                   ` Neil Bothwick
2009-06-09 15:20             ` Etaoin Shrdlu [this message]
2009-06-09 15:30               ` Alan McKinnon
2009-06-09 14:39           ` Mickaël Bucas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200906091720.49610.shrdlu@unlimitedmail.org \
    --to=shrdlu@unlimitedmail.org \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox