Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jun 2022 12:13:59 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 264846] xargs should terminate if line replacement cannot be constructed
Message-ID:  <bug-264846-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264846

            Bug ID: 264846
           Summary: xargs should terminate if line replacement cannot be
                    constructed
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: thj@FreeBSD.org
             Flags: exp-run?

Created attachment 234885
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D234885&action=
=3Dedit
cause xargs to error if line cannot be constructed

https://reviews.freebsd.org/D35574

If the line with replacement cannot be constructed xargs should terminate as
documented in the man page:

-I replstr=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
        Execute utility for each input line, replacing one or more=20=20=20=
=20=20=20=20
        occurrences of replstr in up to replacements (or 5 if no -R flag=20
        is specified) arguments to utility with the entire line of input.
        The resulting arguments, after replacement is done, will not be=20=
=20
        allowed to grow beyond replsize (or 255 if no -S flag is=20=20=20=
=20=20=20=20=20=20
        specified) bytes; this is implemented by concatenating as much of
        the argument containing replstr as possible, to the constructed=20=
=20
        arguments to utility, up to replsize bytes.  The size limit does=20
        not apply to arguments to utility which do not contain replstr,=20=
=20
        and furthermore, no replacement will be done on utility itself.=20=
=20
        Implies -x.

Currently, xargs continues and lines that cannot accommodate the replacement
get
as much of the replstr as will fit in the string. Instead xargs should erro=
r,
include an error when we do.

We encounter this error, but gnu/xargs doesn't because they have a much lar=
ger
limit for created outputs (~10000 lines).

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-264846-227>