A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=1861 ====================================================================== Reported By: stephane Assigned To: ====================================================================== Project: 1003.1(2024)/Issue8 Issue ID: 1861 Category: Shell and Utilities Type: Error Severity: Objection Priority: normal Status: Interpretation Required Name: Stephane Chazelas Organization: User Reference: Section: xargs utility Page Number: 3601 Line Number: 123207-123214 Interp Status: Proposed Final Accepted Text: https://austingroupbugs.net/view.php?id=1861#c6918 ====================================================================== Date Submitted: 2024-10-11 12:32 UTC Last Modified: 2024-10-21 15:18 UTC ====================================================================== Summary: xargs -L broken by https://austingroupbugs.net/view.php?id=243 resolution ====================================================================== Relationships ID Summary ---------------------------------------------------------------------- related to 0000243 Add -print0 to "find" related to 0001853 xargs -x lost an important detail betwe... ======================================================================
---------------------------------------------------------------------- (0006934) geoffclare (manager) - 2024-10-21 15:18 https://austingroupbugs.net/view.php?id=1861#c6934 ---------------------------------------------------------------------- New suggested wording changes... After page 2948 line 98502 section find (EXAMPLES), add:<blockquote>12. In the following command, the user is asked which regular files below the current directory are to be archived. <pre>find . -type f ! -path ./arch -ok ar -r arch {} ';'</pre></blockquote> On page 3601 line 123207 section xargs (OPTIONS,-L), change:<blockquote>Invoke <i>utility</i> for each set of <i>number</i> arguments from standard input. The last invocation of <i>utility</i> shall be with fewer arguments if fewer than <i>number</i> remain. If the <b>-0</b> option is not specified, each line in the standard input shall be treated as containing one argument except that empty lines shall be ignored and a line ending with a trailing unescaped <blank> shall signal continuation to the next non-empty line, inclusive; such continuation shall result in removal of all trailing unescaped <blank> characters and all <newline> characters that immediately follow them from the argument.</blockquote>to:<blockquote>If the <b>-0</b> option is specified, <b>-L</b> <i>number</i> shall be equivalent to <b>-n</b> <i>number</i>, except that option <b>-x</b> may be forced on. If the <b>-0</b> option is not specified, the <i>utility</i> shall be invoked for each non-empty <i>number</i> logical lines of arguments from standard input. The last invocation of <i>utility</i> shall be with fewer logical lines of arguments if fewer than <i>number</i> remain. Each line in the standard input shall be treated as one logical line except that empty lines shall be ignored and a line ending with a trailing unescaped <blank> shall signal continuation of the logical line to the next non-empty line, inclusive; such continuation shall result in removal of all trailing unescaped <blank> characters and all <newline> characters that immediately follow them from the logical line. Option <b>-x</b> may be forced on. If <b>-x</b> is not in effect, fewer arguments than are present in <i>number</i> logical lines of arguments shall be used if the command line length accumulated exceeds the size specified by the <b>-s</b> option (or the default command line length if there is no <b>-s</b> option). Where the arguments from a single logical line are split across more than one constructed command, the constraint imposed by the <i>number</i> limit shall be that no constructed command shall use arguments from more than <i>number</i> logical lines of input.</blockquote> On page 3601 line 123218 section xargs (OPTIONS, -n), change:<blockquote>(or {LINE_MAX} if there is no <b>-s</b> option)</blockquote>to:<blockquote>(or the default command line length if there is no <b>-s</b> option)</blockquote> On page 3601 line 123231 section xargs (OPTIONS, -s) change:<blockquote><ul> <li>The total number of arguments exceeds that specified by the <b>-n</b> option.</li> <li><XSI>The total number of arguments exceeds that specified by the <b>-L</b> option.</XSI></li> </ul></blockquote>to:<blockquote><ul> <li>The number of arguments specified by the <b>-n</b> option would be exceeded.</li> <li><XSI>A constraint specified by the <b>-L</b> option would be exceeded.</XSI></li> </ul></blockquote> On page 3602 line 123241 section xargs (OPTIONS, -x), after applying bug https://austingroupbugs.net/view.php?id=1853 change:<blockquote>Terminate if a command line containing <i>number</i> arguments (see the <b>-n</b> option) <XSI>or <i>number</i> lines (see the <b>-L</b> option)</XSI> that will fit in the implied or specified size (see the <b>-s</b> option) cannot be constructed. Applications should use the <b>-x</b> option when it would not be appropriate for constructed commands to contain fewer than <i>number</i> arguments; for example, when executing the <i>diff</i> utility with <b>-n</b> 2 in order to compare pairs of files.</blockquote>to:<blockquote>Terminate if a command line containing <i>number</i> arguments (see the <b>-n</b> option) <XSI>or arguments from <i>number</i> logical lines of input (see the <b>-L</b> option)</XSI> that will fit in the implied or specified size (see the <b>-s</b> option) cannot be constructed. Applications should use the <b>-x</b> option when it would not be appropriate for constructed commands to contain fewer arguments; for example, when executing the <i>diff</i> utility with <b>-n</b> 2 in order to compare pairs of files.</blockquote> On page 3604 line 123352 section xargs (EXAMPLES), change:<blockquote><pre>find . -type f -print0 | xargs -0 -p -L 1 ar -r arch</pre></blockquote>to:<blockquote><pre>find . -type f ! -path ./arch -print0 | xargs -0rp -n 1 ar -r arch</pre> (See also the EXAMPLES for <i>find</i> which include a command to achieve the same result using only <i>find</i>.)</blockquote> After page 3604 line 123357 section xargs (EXAMPLES), add:<blockquote>5. The following commands demonstrate the difference between the <b>-n</b> and <b>-L</b> options (when <b>-0</b> is not used).<pre>cat file <b>a b "\\ c //" d e f g</b> < file xargs -xL 2 sh -c 'IFS=,; printf "%d: [%s]\n" "$#" "$*"' sh <b>5: [a,b,\\ c //,d,e] 2: [f,g]</b> < file xargs -n 2 sh -c 'IFS=,; printf "%d: [%s]\n" "$#" "$*"' sh <b>2: [a,b] 2: [\\ c //,d] 2: [e,f] 1: [g]</b> </pre></blockquote> After page 3604 line 123342 section xargs (APPLICATION USAGE), add:<blockquote>Implementations differ as to whether option <b>-L</b> forces on option <b>-x</b>. Portable applications should explicitly specify <b>-x</b> when using <b>-L</b>.</blockquote> Issue History Date Modified Username Field Change ====================================================================== 2024-10-11 12:32 stephane New Issue 2024-10-11 12:32 stephane Name => Stephane Chazelas 2024-10-11 12:32 stephane Section => xargs utility 2024-10-11 12:32 stephane Page Number => 3601 2024-10-11 12:32 stephane Line Number => 123207-123214 2024-10-11 16:28 stephane Note Added: 0006913 2024-10-12 05:57 stephane Note Added: 0006914 2024-10-14 16:13 geoffclare Note Added: 0006916 2024-10-15 05:09 stephane Note Added: 0006917 2024-10-15 05:23 stephane Note Edited: 0006917 2024-10-17 09:08 geoffclare Note Added: 0006918 2024-10-17 09:12 geoffclare Relationship added related to 0000243 2024-10-17 15:12 geoffclare Note Edited: 0006918 2024-10-17 15:12 geoffclare Interp Status => Pending 2024-10-17 15:12 geoffclare Final Accepted Text => https://austingroupbugs.net/view.php?id=1861#c6918 2024-10-17 15:12 geoffclare Status New => Interpretation Required 2024-10-17 15:12 geoffclare Resolution Open => Accepted As Marked 2024-10-17 15:13 geoffclare Tag Attached: tc1-2024 2024-10-17 16:25 agadmin Interp Status Pending => Proposed 2024-10-17 16:25 agadmin Note Added: 0006921 2024-10-18 06:34 stephane Note Added: 0006922 2024-10-18 07:02 stephane Note Added: 0006923 2024-10-18 07:08 stephane Note Added: 0006924 2024-10-18 07:10 stephane Note Edited: 0006924 2024-10-18 08:39 geoffclare Note Added: 0006925 2024-10-18 18:59 stephane Note Edited: 0006922 2024-10-19 20:56 stephane Note Added: 0006927 2024-10-19 21:10 gbrandenrobinsonNote Added: 0006928 2024-10-20 07:24 stephane Note Added: 0006929 2024-10-20 08:25 stephane Note Added: 0006930 2024-10-20 19:54 stephane Note Edited: 0006922 2024-10-20 19:57 stephane Note Edited: 0006922 2024-10-20 19:58 stephane Note Edited: 0006922 2024-10-21 06:20 stephane Note Added: 0006931 2024-10-21 09:01 geoffclare Note Added: 0006932 2024-10-21 09:02 geoffclare Note Edited: 0006932 2024-10-21 11:35 geoffclare Relationship added related to 0001853 2024-10-21 15:18 geoffclare Note Added: 0006934 ======================================================================
