A NOTE has been added to this issue. 
====================================================================== 
https://www.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://www.austingroupbugs.net/view.php?id=1861#c6918 
====================================================================== 
Date Submitted:             2024-10-11 12:32 UTC
Last Modified:              2024-10-18 06:34 UTC
====================================================================== 
Summary:                    xargs -L broken by
https://www.austingroupbugs.net/view.php?id=243 resolution
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0000243 Add -print0 to "find"
====================================================================== 

---------------------------------------------------------------------- 
 (0006922) stephane (reporter) - 2024-10-18 06:34
 https://www.austingroupbugs.net/view.php?id=1861#c6922 
---------------------------------------------------------------------- 
Thanks for the quick resolution. An extra change IMO worth applying and
that was not mentioned in my original request:

I'd change:

find . -type f -print0 | xargs -0 -p -L 1 ar -r arch

to:

find . -type f -print0 | xargs -r -0 -p -n 1 ar -r arch

That is:

1. (unrelated) add -r so ar be not called with one empty argument if no
regular file is found.
2. Change -n to -L which would be more canonical. -L suggests "Line" which
is confusing with -0, where -L is an alias for -n for no better meaning to
give to it there.

It would probably be worth giving an example showing the difference between
-n and -L given so many people are confused about them (and many also
wrongly assume xargs works with lines in general).

Maybe something like:

<pre>
xargs -L2 sh -c 'IFS=,; printf "%d: <%s>\n" "$#" "$*"' sh << 'EOF'
a b "\\ c //" d
e
f
g
EOF
</pre>

Where that inline sh script is passed the arguments from 2 lines at a time
giving:

<pre>
5: <a,b,\ c /,d,e>
2: <f,g>
</pre>

To be compared with:

<pre>
xargs -L2 sh -c 'IFS=,; printf "%2d: <%s>\n" "$#" "$*"' sh << 'EOF'
a b "\\ c //" d
e
f
g
EOF
</pre>

Where the script is passed 2 arguments at a time regardless of which lines
those come from, giving:

<pre>
2: <a,b>
2: <\\ c //,d>
2: <e,f>
1: g
</pre> 

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://www.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                          
======================================================================


  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [1003.1(2024... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to