The following issue has been SUBMITTED. 
====================================================================== 
https://austingroupbugs.net/view.php?id=1600 
====================================================================== 
Reported By:                geoffclare
Assigned To:                
====================================================================== 
Project:                    1003.1(2016/18)/Issue7+TC2
Issue ID:                   1600
Category:                   Rationale
Type:                       Error
Severity:                   Comment
Priority:                   normal
Status:                     New
Name:                       Geoff Clare 
Organization:               The Open Group 
User Reference:              
Section:                    C.1.7 Built-In Utilities 
Page Number:                3716 
Line Number:                127366 
Interp Status:              --- 
Final Accepted Text:         
====================================================================== 
Date Submitted:             2022-08-23 09:28 UTC
Last Modified:              2022-08-23 09:28 UTC
====================================================================== 
Summary:                    Problems with the suggested single-line shell
script: $0 "$@"
Description: 
On the mailing list, Jakub Wilk reported a problem with the rationale in
C.1.7 that talks about implementing the 16 (sic) regular built-ins as a
single-line shell script:<pre>$0 "$@"</pre>
As he pointed out, "This wouldn't actually work: $0 is the absolute path,
so the script would recurse indefinitely."

Another problem is that these external utilities are supposed to be
exec-able using "the exec family of functions", which means all six
functions not just execlp() and execvp(), so the script needs a #! line
(and can only meet the requirements on systems that support #!).

Finally, the number 16 is out of date, as there are now 20 utilities in the
table in XCU 1.7.

Desired Action: 
Change:<blockquote>However, it has been pointed out that all 16 utilities
in the table can be provided with 16 links to a single-line shell
script:<pre>$0 "$@" </pre></blockquote>to:<blockquote>However, it has been
pointed out that, on systems that support the (non-standard but ubiquitous)
"#!" mechanism to make scripts executable by the <i>exec</i> family of
functions, all of the utilities in the table can be provided as links to a
two-line shell script:<pre>#! /path/to/sh
${0##*/} "$@"</pre></blockquote>

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2022-08-23 09:28 geoffclare     New Issue                                    
2022-08-23 09:28 geoffclare     Name                      => Geoff Clare     
2022-08-23 09:28 geoffclare     Organization              => The Open Group  
2022-08-23 09:28 geoffclare     Section                   => C.1.7 Built-In
Utilities
2022-08-23 09:28 geoffclare     Page Number               => 3716            
2022-08-23 09:28 geoffclare     Line Number               => 127366          
2022-08-23 09:28 geoffclare     Interp Status             => ---             
======================================================================


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

Reply via email to