[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: xargs: doesn't fail on missing terminator (which may have severe con
From: |
raf |
Subject: |
Re: xargs: doesn't fail on missing terminator (which may have severe consequences) |
Date: |
Thu, 19 Dec 2024 12:21:08 +1100 |
On Sat, Dec 14, 2024 at 07:55:33PM +0100, Christoph Anton Mitterer
<calestyo@scientia.org> wrote:
> Hey.
>
> On Fri, 2024-12-13 at 23:05 +0100, Bernhard Voelker wrote:
> > I never saw a practical example why it would be dangerous.
>
> [...]
>
> > Second, my main point, is that I believe that there is confusion
> > about what -0, --null stands for.
> > The usage output clarifies:
> >
> > -0, --null items are separated by a null, not
> > whitespace;
> > disables quote and backslash
> > processing and
> > logical EOF processing
> >
> > The crucial word is "separate" which means it is something in between
> > 2 entries:
> > entry1 <separator> entry2
> > It is and was never a "terminator", i.e., something acknowledging
> > that the previous
> > entry is committed.
> > entry1 <terminator>
That might be what the "usage output" says, but it is not what find(1)
does. It is treating NUL as a terminator in the sense that the last
byte output with -print0 is a NUL. But that's find, not xargs.
And my copy of the GNU xargs [(GNU findutils) 4.10.0] manual entry
says otherwise:
-0, --null
Input items are terminated by a null character instead of by whitespace...
So the "usage output" disagrees with the manual entry.
It's probably the usage output that is wrong since the
manual entries for find and xargs agree with each other.
cheers,
raf