[BusyBox] [patch] Why busybox xargs is broken.

Vladimir N. Oleynik dzo at simtreas.ru
Mon Oct 6 10:40:47 UTC 2003


Glenn,

> Attached is a patch that adds the -n option to xargs, and it should be
> easy to extend it further.

Heh. You make my work ;-)
I attached new version with support "-n max_arg" but for pre-previous CVS verions.
I like not your changes:

1.

  + * BUGS: -p doesnt accept user input
+ *

Really?

./busybox xargs -p
1
/bin/echo 1 ?...y
1

Work fine. And you revrote absoluteli same algorithm. but with code bigger.


2. 	
  	/* allocating pointers for execvp: a*arg, arg from stdin, NULL */
-	args = xcalloc(a + 3, sizeof(char *));
+	args = xcalloc(a + 2, sizeof(char *));

No! See comment.

+if (wpid == -1 && errno == ECHILD) {
+  	                         /* we missed its termination */
+  	                         break;
+  	                 }


Why?! We generate ONE child and wait die her. This code not required.

Also. Last patch corrected previous libbb/getopt_ulflags.c broken for parse 
"+flags".


--w
vodz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: last_patch115.gz
Type: application/x-tar
Size: 2211 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20031006/4d635ee9/attachment.tar 


More information about the busybox mailing list