Re: tcsh being dodgy, or pipe code ishoos?

From: Juli Mallett <jmallett_at_FreeBSD.org>
Date: Tue, 24 Jun 2003 23:47:07 -0500
* 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
_at__at_ -123,7 +123,7 _at__at_
                /* 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;
Received on Tue Jun 24 2003 - 19:47:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:13 UTC