ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kendall Collett" <kcoll...@convio.com>
Subject Re: does <apply> do the xargs thing?
Date Mon, 01 Jul 2002 02:19:41 GMT
From: "Stefan Bodewig" <bodewig@apache.org>:

> On Fri, 21 Jun 2002, Kendall Collett <kcollett@convio.com> wrote:
>
> > This makes me suspect that the implementation of <apply> isn't doing
> > the xargs thing where the system limits on number of command
> > arguments etc. is taken into account.
>
> Err, right.
>
> > (Is there even a way to do this portably w/in Java?)
>
> If you can give me a pointer to "the xargs thing", I may be able to
> answer the question 8-)
>
> Do you mean writing all command line arguments to a pipe with Unix's
> xargs on the other end?  I've never tried.  Is it guaranteed to get
> around the command line lenght issue?


Yes, xargs is guaranteed to avoid system limitations on command-line length
and/or number of command line arguments.  For example, where "grep getThing
*/*.java */*/*.java" can fail with something like "argument list too long"
(E2BIG) if you have too many matching .java files, "find . -name
'*.java' -print | xargs grep getThing" will not run into this problem
because xargs will "spread" the argument list across multiple grep
invocations to avoid running into any system limitations.  (You can use
the -t option to see the command invocations that xargs is making.)

You can see another xargs example (for "rm" instead of "grep") at
<http://www.bgw.org/tutorials/utilities/rm.php3>.

>
> If so, we could at least use it on Unix-like system - the whole <exec>
> stuff is not portable anyway.

Well, according to the documentation of E2BIG in the exec(2) manpage (I
found a copy at <http://www.mcsr.olemiss.edu/cgi-bin/man-cgi?exec+2>), E2BIG
can occur when "[t]he number of bytes in the new process's argument list is
greater than	the system-imposed limit {ARG_MAX} [see sysconf(2), intro(2),
and limits.h]."  I'm not sure if there is a way to get at the relevant
numbers using (pure) Java.

Kendall

PS: Sorry for the tardy response--I was on vacation.




--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message