On Fri, Feb 05, 2010 at 02:49:16AM +0100, Ingo Schwarze wrote:
> Atte Peltomdki wrote on Thu, Feb 04, 2010 at 12:48:47PM +0200:
> > On Tue, Feb 02, 2010 at 09:32:43PM +0100, Ingo Schwarze wrote:
> >> Antti Harri wrote on Tue, Feb 02, 2010 at 07:31:57PM +0200:
> 
> >>> xargs' -L switch isn't working when using -0 flag.
> 
> >> After checking POSIX.1 (2008), 

Where did you find it btw? I can't find 2008 edition anywhere that
wouldn't require registration and whatnot. 

> > Using -0 for xargs simply means "Use \0 as otherwise \n or whitespace
> > are used".
> 
> That's horribly imprecise.  Rather, it means "interpret NUL and only NUL
> as the argument separator".  I do not think that -0 should change the
> meaning of the term "line". 

It seems a bit difficult to interpret the exact technical specification
of -print0/-0 from manual pages. I tried quickly googling for references
to original discussion on these extensions, first hit was your mail I'm
replying to now. Heh. :-)
 
> >>> Tested also on OS X and Linux and they print two lines with -0.
> 
> >> So you might wish to file bug reports with these operating systems.
> 
> > I suggest OpenBSD rather change their -0 semantics to match those of
> > every other vendor which implement -0 in xargs. 
> 
> Nobody is discussing -0 semantics, it's -I and -L semantics that are at
> stake.  And it looks like everyone else broke -L in their code.
>
> [snipped excellent overhaul of whole issue and different implementations]
>
> What a mess...  :-(

It is really a mess. Which is why I would simply opt for just going with 
the flow on this one for sake of portability. 

Discussion of it has been interesting though, I'm still having a bit 
trouble wrapping my head around the subject. While your technical 
reasoning makes a valid point, it appears natural and intuitive to me to 
expect -0 simply make xargs interpret nullchar as a newline since
-print0 just changed newlines into nullchars and -0 is announced as it's
counterpart. I understand this is not technically entirely accurate, but
it seems to be how most people view it. 

-- 
Atte Peltomdki
     atte.peltom...@iki.fi <> http://kameli.org
"Your effort to remain what you are is what limits you"

Reply via email to