Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

behavior of in-line variable assignments preceding functions, special built-ins



I haven't worked out whether the change described below renders zsh's
assignment behavior non-conforming.


----------------------------------------------------------------------
 (0001559) rhansen (reporter) - 2013-05-02 04:39
 http://austingroupbugs.net/view.php?id=654#c1559
----------------------------------------------------------------------
Proposed changes:

In Issue7+TC1 XCU Section 2.9.1 at page 2339 lines 74354-74361, change:

    If no command name results, or if the command name is a special
    built-in or function, variable assignments shall affect the
    current execution environment.  Otherwise, the variable
    assignments shall be exported for the execution environment of the
    command and shall not affect the current execution environment
    except as a side-effect of the expansions performed in step 4.  In
    this case it is unspecified:

      * Whether or not the assignments are visible for subsequent
        expansions in step 4

      * Whether variable assignments made as side-effects of these
        expansions are visible for subsequent expansions in step 4, or
        in the current shell execution environment, or both

to:

    Variable assignments shall be performed as follows:

      * If no command name results, variable assignments shall affect
        the current execution environment.

      * If the command name is not a special built-in utility or
        function, the variable assignments shall be exported for the
        execution environment of the command and shall not affect the
        current execution environment except as a side-effect of the
        expansions performed in step 4.  In this case it is
        unspecified:

          - Whether or not the assignments are visible for subsequent
            expansions in step 4

          - Whether variable assignments made as side-effects of these
            expansions are visible for subsequent expansions in step
            4, or in the current shell execution environment, or both

      * If the command name is a standard utility implemented as a
        function (see XBD Section 4.21), the effect of variable
        assignments shall be as if the utility was not implemented as
        a function.

      * If the command name is a special built-in utility, variable
        assignments shall affect the current execution environment.
        Unless the 'set -a' option is on (see the 'set' special
        built-in utility in Section 2.14), it is unspecified:

          - Whether or not the variables shall gain the export
            attribute during the execution of the special built-in
            utility

          - Whether or not export attributes gained as a result of the
            variable assignments shall persist after the completion of
            the special built-in utility

      * If the command name is a function that is not a standard
        utility implemented as a function, variable assignments shall
        affect the current execution environment during the execution
        of the function.  It is unspecified:

          - Whether or not the variable assignments shall persist
            after the completion of the function

          - Whether or not the variables shall gain the export
            attribute during the execution of the function

          - Whether or not export attributes gained as a result of the
            variable assignments shall persist after the completion of
            the function (if variable assignments persist after the
            completion of the function)

In Issue7+TC1 XCU Section 2.9.5 at page 2347 lines 74675-74676, change:

    When a function is executed, it shall have the syntax-error and
    variable-assignment properties described for special built-in
    utilities in the enumerated list at the beginning of Section 2.14.

to:

    When a function is executed, it shall have the syntax-error
    properties described for special built-in utilities in the first
    item in the enumerated list at the beginning of Section 2.14.

In Issue7+TC1 XCU Section 2.14 at page 2356 lines 75105-75106, change:

      2. Variable assignments specified with special built-in
         utilities remain in effect after the built-in completes; this
         shall not be the case with a regular built-in or other
         utility.

to:

      2. As described in Section 2.9.1, variable assignments preceding
         the invocation of a special built-in utility remain in effect
         after the built-in completes; this shall not be the case with
         a regular built-in or other utility.

In Issue7+TC1 XCU Section 2.14 'export' at page 2372 lines 75584-75587,
change:

    When no arguments are given, the results are unspecified.  If a
    variable assignment precedes the command name of export but that
    variable is not also listed as an operand of export, then that
    variable shall be set in the current shell execution environment
    after the completion of the export command, but it is unspecified
    whether that variable is marked for export.

to:

    When no arguments are given, the results are unspecified.

(Note that this change reverts the changes made for issue #352, but the
changes for XCU Section 2.9.1 result in no net change in the specified
behavior of the 'export' special built-in utility.)



Messages sorted by: Reverse Date, Date, Thread, Author