Comments (4)
This bug was originally reported in att#7. It is caused by the following section of code, which does not save the state of variables in a newer scope:
ksh/src/cmd/ksh93/sh/subshell.c
Lines 254 to 256 in ef1621c
I have made a pull request (#16) to fix this bug.
from ksh.
For the acronym-deficient: SSCCE. Take your pick, all of them might apply... ;)
Meanwhile, I've found that if we change the second function's form to that of a POSIX subshell function definition:
unset a b
c=0
function set_ac { a=1; c=1; }
set_abc() ( set_ac ; b=1 )
set_abc
echo "a=$a b=$b c=$c"
…the bug vanishes. Which suggests to me that it is probably a bug in the parser, and not so much in the subshell mechanism itself. It appears that the subshell in your original SSCCE is wrongly optimised out.
from ksh.
My suspicion that it was a parser issue looks to be wrong. If you change set_abc()
back into a ksh-style function and defeat any possible optimisation by adding an extra command:
function set_abc { ( set_ac ; b=1 ); echo end; }
…then the bug still occurs.
from ksh.
Fixed by #16. Many thanks @JohnoKing!
from ksh.
Related Issues (20)
- getopts: not setting OPTARG when argument is both long form and declared optional HOT 4
- Got a "Memory fault" when trying to sum up to 1.000.000 using a recursive impl. of Gauss' algorithm HOT 2
- trap execution alters $? HOT 2
- Regression. Non determinsitic QA cycle (race condition) HOT 8
- parser confusions with braces inside ${ cmd; } form of command substitution HOT 1
- getopts OPTIND cf. OPTARG in functions
- free(): invalid pointer crash in path_pwd HOT 6
- stack overflow if cannot unlink $HOME/.sh_history HOT 1
- Negative integer literal with radix symbol should be formatted as positive with unary minus for integers defined with an explicit base. HOT 5
- 1.0.8: tons of compile time warnings. HOT 21
- nameref iteration problem HOT 5
- New `$SRANDOM` feature uses a set seed on Cygwin HOT 7
- NetBSD, DragonFlyBSD and illumos now fail to build without manually passing `LDFLAGS=-lm` HOT 7
- Build error on Kali Linux w/ 1afa0075 HOT 8
- Regression test failure @32950afe w/ macOS 12.7.3 (Intel or ARM) HOT 16
- Segfault on startup in NetBSD and DragonFlyBSD single user mode HOT 1
- builtin printf: null in format string skips input HOT 15
- echo doesn't work in namespaces (and other UNIVERSE handling oddities) HOT 4
- optional builtin not found when run from namespace
- bogus typeset -p output for compounds with disciplines
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ksh.