From owner-freebsd-hackers Mon May 14 20:32:12 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id B8F3237B422 for ; Mon, 14 May 2001 20:32:07 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f4F3VuF86280; Mon, 14 May 2001 23:31:56 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: References: <200105121004.f4CA4gX91830@hak.lan.Awfulhak.org> Date: Mon, 14 May 2001 23:31:53 -0400 To: Cyrille Lefevre , Brian Somers From: Garance A Drosihn Subject: Re: xargs(1) "replstr" patch Cc: Dima Dorfman , hackers@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 4:09 AM +0200 5/15/01, Cyrille Lefevre wrote: >Brian Somers writes: > >> I'd suggest going ahead and committing it ASAP - before people start >> ``discussing'' it again :oI > >from my point of view, it would be better to implement -i/-I than this >hack which has no advantage in performance and functionality than : > >while read arg; do CMD LINE $arg ARGS; done < test I think this proves the wisdom of Brian's suggestion... :-) - - - - Your 'while' loop *will* be more expensive than the result of: cat test | xargs -J [] CMD LINE [] ARGS although you would probably need a lot of files in 'test' to really notice the difference... In fact, from what I can tell, your while loop is exactly equivalent to: cat test | xargs -I {} CMD LINE {} ARGS You have not re-implemented -J, you have re-implemented -I. Ie, it is -I which has no real performance benefit, and can be functionally duplicated in about a hundred different ways. If the file 'test' contains the lines 'a\nb\nc\nd\n', then your example will execute: CMD LINE a ARGS CMD LINE b ARGS CMD LINE c ARGS CMD LINE d ARGS I know this is what your example will do, because I just executed your exact example with that. It is also what '-I' will do, as I have just tested THAT on a system which DOES implement '-I'. Meanwhile the above-described use of '-J' will result in: CMD LINE a b c d ARGS I also know what 'xargs -J' will do, because I just executed THAT too. Please note that I am not trying to be obnoxious here, I am trying to be courteous. Dima and I asked for opinions, you gave your opinion, and I researched what you suggested. I am just listing my results of taking the time to evaluate your suggestion seriously, because we did ask for input. Please read EXACTLY what -I does (in the standard description) and EXACTLY what -J does (in the patch committed to -current, complete with a man page entry that tries to be very precise as to what -J does). It may seem silly to take a lot of time to read all of this and try some examples, but that's exactly what Dima and I have been doing for the past few weeks. - - - - Still, let me say that I do hope to get back to 'xargs', and add the -I option. I must admit my enthusiasm for doing -I wore off after seeing the current code to 'xargs'. Not only is -J more useful, but it is much less work to implement (given the current code as a starting point) than -I would be. Still, it *would* be nice to say we have '-I', just to match what the various standards list for options to 'xargs'. While I do like the idea of adding it, I'll admit that it isn't a particularly high priority on my list of things to do... -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message