Christoph Anton Mitterer wrote, on 09 Dec 2024:
> 
> With respect to xargs and the matter what it should do when any input
> "line" is not properly NUL terminated, the Future Directions now say:
> 
> > FUTURE DIRECTIONS
> > A future version of this standard may require that, when the -0
> > option is specified, if the standard input is not empty and does not
> > end with a null byte, xargs ignores the trailing non-null bytes.
> 
> 
> I've just tried to find whether it was ever discussed whether it should
> rather give an error in that case, but couldn't find any thing.

The resolution of bug 1872 changes "xargs ignores the trailing non-null
bytes" to "xargs treats the trailing non-null bytes as an error".
(Plus an equivalent change to the normative text, so the error is
recommended via the use of "should".)

> Was it ever considered to go the same direction in the case without
> -0? I.e. require every line to be LF terminated?

Bug 1872 also addresses this.  It adds the following to RATIONALE:

    When the -0 option is not specified, if the standard input is not
    empty and does not end with a <newline>, then the input is not a
    text file, and therefore the behavior is undefined. However, it is
    recommended that xargs diagnoses the trailing non-<newline>
    characters (for consistency with the recommendation for -0 and
    trailing non-null bytes).

-- 
Geoff Clare <[email protected]>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England

  • xargs future... Christoph Anton Mitterer via austin-group-l at The Open Group
    • Re: xar... Geoff Clare via austin-group-l at The Open Group
      • Re:... Christoph Anton Mitterer via austin-group-l at The Open Group
        • ... Geoff Clare via austin-group-l at The Open Group

Reply via email to