tcsh being dodgy, or pipe code ishoos?
Juli Mallett
jmallett at FreeBSD.org
Tue Jun 24 21:47:07 PDT 2003
* Tim Kientzle <kientzle at acm.org> [ Date: 2003-06-24 ]
[ w.r.t. Re: tcsh being dodgy, or pipe code ishoos? ]
> Artem 'Zazoobr' Ignatjev wrote:
> > Juli Mallett wrote:
> >
> >>Anyone with insight into this?
> >>
> >>(jmallett at big-lizard:~)39% ( echo 1 ; ( ( echo 2 ; echo 3 ) | xargs -I% echo + % ) )
> >>1
> >>+ 2
> >>+ 3
> >>(jmallett at big-lizard:~)40% ( echo 1 ; ( ( echo 2 ; echo 3 ) | xargs -I% echo + % ) ) | cat
> >>1
> >>+ +2
> >>3
> >
> > last cat is not necessary...
> > And it's more weird than that:
> >
> >>( echo 1 ; ( ( echo 2 ; echo 3 ) | xargs -I% echo -- + % ) )
> >
> > 1
> > -- --+ +2
> > 3
> >
>
>
> Hmmm... This looks like xargs isn't waiting for the subcommand
> to exit. This looks like 'echo -- + 2' and 'echo -- + 3' are
> running concurrently.
How about this, it essentially says that in the not -P case, no procs
may be unwaited-on, whereas otherwise we say that 1 may be unwaited-on..
Thanx,
juli.
%%%
Index: xargs.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/xargs/xargs.c,v
retrieving revision 1.54
diff -d -u -r1.54 xargs.c
--- xargs.c 13 Jun 2003 17:05:41 -0000 1.54
+++ xargs.c 25 Jun 2003 04:45:39 -0000
@@ -123,7 +123,7 @@
/* 1 byte for each '\0' */
nline -= strlen(*ep++) + 1 + sizeof(*ep);
}
- maxprocs = 1;
+ maxprocs = 0;
while ((ch = getopt(argc, argv, "0E:I:J:L:n:oP:pR:s:tx")) != -1)
switch(ch) {
case 'E':
%%%
--
juli mallett. email: jmallett at freebsd.org; efnet: juli;
More information about the freebsd-current
mailing list