-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix += operator in invocation-local scopes (re: 75796a9)
This commit fixes multiple related bugs in invocation-local scopes when using the += operator. Changes: - In sh_exec and sh_ntfork(), increment sh.invoc_local when entering an invocation-local scope, and decrement it when exiting the local scope. The nv_putval() function makes use of this variable when copying the parent scope variable into the local scope, which avoids setting the wrong scope for independent foo+= statements. - To avoid possible function scoping bugs, reset sh.invoc_local in function scopes created with sh_funscope(). Set sh.invoc_local back to its previous value when exiting the function's static scope. - In nv_create(), fix a regression introduced in ksh93t- 2008-06-02. The regression causes nv_search to use the wrong scope, because nv_search doesn't use the NV_NOSCOPE flag (formerly HASH_NOSCOPE, see 2e816c3). As a result, nv_search will not find the locally scoped variable (since nv_putval has yet to create it) and searches the parent scope. This results in the variable node pointing to the parent scope's variable, resulting in the variable no longer having a local scope. To avoid this problem without introducing regression test failures, the resulting node found by nv_search is initially set to an mp pointer. The np pointer will only be set to mp (the result from nv_search) when needed (most of the time, this isn't in an invocation-local scope). Co-authored-by: Martijn Dekker <martijn@inlv.org> Resolves: #533
- Loading branch information
Showing
6 changed files
with
81 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters