[Toybox] toybox - added cmp

Rob Landley rob at landley.net
Wed Feb 15 04:37:01 PST 2012


On 02/15/2012 01:47 AM, Frank Bergmann wrote:
> Hi Rob,
> 
> On Tue, Feb 14, 2012 at 09:01:34AM -0600, Rob Landley wrote:
>> Please read what I wrote.
> 
> I've already done it but I also read xargs(1) which has a statement which
> doesn't make any sense in the context of the explanations. But please read
> on.

I really don't want to be having this argument.  My point was that
getline variants can only be efficiently implemented by reading blocks
of data which tend to go past the end of line marker, and then the
leftover data can't put put back into the filehandle so you have to
treat it specially, which is annoying.

You apparently do not find it annoying.  Good for you.

>> I'm explaining _why_ xargs must close the descriptor, due to exactly the
>> limitation I was explaining.  It would be _useful_ to have -E delimit
>> input between command line options and child stdin, but turns out to be
>> difficult enough to implement that the standard allows but does not
>> require it.
>>
>> This is not the only place this comes up, it's just one I hit recently
>> when I was implementing xargs, so it was fresh in my mind.
> 
> OK, I got it. Now I understand what you're thinking about but it sounds
> crazy to me. :-)
> 
> I mentioned xargs(1). It says
> "If the end of file string occurs as a line of input, the rest of the
> input is ignored."
> (GNU findutils).
> But this is only a man-page and it is a GNU man-page which describes the
> behavior of a GNU utility. ;-)
> 
> I read the standard at http://pubs.opengroup.org/onlinepubs/009695399 but
> I didn't find a comparable statement.

Look for this bit:

> The results are unspecified if the utility named by utility attempts
> to read from its standard input.

I.E. we know passing the data after -E to the command would be nifty,
but a pain to implement.  We aren't going to expect it of you, but
aren't going to forbid it either.

>>> (er... at this point I think about some clone options which should make
>>> it possible to even share FILE* filehandles. ;-) )
>>
>> You mean the way after a fork _both_ children have the buffered data and have
>> to work out which one's going to use it?
> 
> Yes, IMHO this is possible with clone and specific options. But it's crazy
> and just a joke. No one ever should do this. The LKML would speak a holy
> curse against him. ;-)

See "annoying", above.

> Frank

Rob

 1329309421.0


More information about the Toybox mailing list