Austin Group Defect Tracker

Aardvark Mark III


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001194 [1003.1(2016)/Issue7+TC2] Shell and Utilities Editorial Clarification Requested 2018-04-23 18:10 2018-04-24 09:07
Reporter steffen View Status public  
Assigned To
Priority normal Resolution Open  
Status New  
Name steffen
Organization
User Reference
Section vol. 3: sh
Page Number 3239
Line Number 108848
Interp Status ---
Final Accepted Text
Summary 0001194: sh: mention historic function body in APPLICATION USAGE
Description Unix Version 8 shell and others documented functions as

     name () command
            Define a function which is referenced by name. The body of the
            function is the command. The most useful form of command is a
            sequence of commands enclosed by { and }. Execution of
            functions is described below (see Execution).

Where command was

     A command is either a simple-command or one of the following. Unless
     otherwise stated, the value returned by a command is that of the last
     simple-command executed in the command.

And whereas the POSIX base specifications include

       It should be noted that implementations will have different kinds of extensions. Some will reflect
        “historical usage” and will be preserved for execution of pre-existing applications. These functions
        should be considered “obsolescent” and the standard functions used for new applications.

the fact that many current shells (still) support the original function syntax are worth to the noted.
Desired Action Insert the following sentence at the given location:

Whereas historically the argument of shell functions (see xref 2.9.5, Function Definition Command) has been any command related shell construct, including [xref 2.9.1] simple commands, [xref 2.9.2] pipelines and [xref 2.9.3] lists, the POSIX standard shell only supports [xref 2.9.4] compound commands.
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0003994)
joerg (reporter)
2018-04-24 09:07

name () { list;} Define a function which is refer-
                                enced by name. The body of the
                                function is the list of commands
                                between { and }. The { must be
                                followed by a space. Execution of
                                functions is described below (see
                                Execution section). The { and }
                                are unnecessary if the body of
                                the function is a command as
                                defined above, under Commands.

Is in the AT&T sh manpage.

But the text in the POSIX standard is not related to that but rather to the ksh function definition:

      function identifier { list ;}
         Define a function which is referenced by identifier. The
         body of the function is the list of commands between {
         and }. See Functions.


Since the POSIX text mentions only the version with a compound statement, I see no reason for a need to add more hints.

- Issue History
Date Modified Username Field Change
2018-04-23 18:10 steffen New Issue
2018-04-23 18:10 steffen Name => steffen
2018-04-23 18:10 steffen Section => vol. 3: sh
2018-04-23 18:10 steffen Page Number => 3239
2018-04-23 18:10 steffen Line Number => 108848
2018-04-24 09:07 joerg Note Added: 0003994


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker