tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: find -print0 "limited utility"



 >> FYI:
 >> Why 'xargs -0' and 'find -print0' was/is absent in Caldera/Solaris
 >> and others?
 >>
 >> From wip/heirloom-find (opensourced by Caldera years ago) manual page.
 >>
 >>       The -print0 operand supported by some other implementations is
 >>       considered a very limited work-around since it does not allow
 >>       the output to be processed by utilities unaware of NUL
 >>       characters; it has therefore not been included here.

> Are you answering your own question, or does the answer given not make
> sense to you?

This was just thoughts about why 'xargs -0' is not standard
and what may change now with getdelim(3).

getdelim(3) solves (more or less) the problem with "utilities unaware
of NUL characters". xargs -0 itself can now be reimplemented and simplified
with a help of getdelim(3). The same for all other utilities.

> Personally I think the answer is bogus -- "find -print0" is intended
> primarily for use with "xargs -0" and it is expected to be of no use
> with any other existing standard utility, however I think that is
> sufficient reason alone for its existence.
In my view, xargs itself is ugly hack.
In "standard" utilities I whould prefer to see special option, say, `-:'
for reading _filenames_ from stdin. Ideally ALL utilities
should support `-:' _by default_, just like filenames are passed
through argv in almost all unix utilities.
But this is something about UNIX ideology :-)

With xargs there is another serious problem.
'xargs mkdir -p < /dev/null' fails on Linux/Solaris/HP-UX/Interix etc.
*BSD default is IMHO much better but this incompatibility is very serious.

> If other utilities besides xargs can also be made more useful by
> including the option of reading pathnames delimited by NUL
> characters, then they should be enhanced.
Yes. And I think getdelim(3) helps to do this.

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index