From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9602 invoked by alias); 2 May 2013 22:33:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31366 Received: (qmail 29971 invoked from network); 2 May 2013 22:33:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,FROM_12LTRDOM autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) Date: Thu, 2 May 2013 14:44:17 -0700 (PDT) From: Bart Schaefer Reply-To: Bart Schaefer To: zsh-workers@zsh.org Subject: behavior of in-line variable assignments preceding functions, special built-ins Message-ID: User-Agent: Alpine 2.00 (LRH 1167 2008-08-23) X-Face: "f/X=UCVgd*^c>+x(gMq0at?e:woX+;'snkkRzc3SX<0AZ (/PS4.M2hzGS9X:Qj]at_H/%a9K}:-eS<"v_7vX84PG9Bf Zpb`wI!I4geY=or+nWq`3CX`oq&TJR;g^ps|7(MH?jh;bs %vHJfCh5>a*6Re5m|Bidja\\o]>n\A)ib1:yX*T`zR(*h~ %tOw<~!D9{e6h!8M2:d8G2@K>y^1I_Vdy\d\MYe]z7c MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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.)