Comments (3)
Thanks for the bug report! (Quick tip: saying someone's software "doesn't actually work" when you've found a single bug isn't the nicest way to say hello.)
I suspect this is an issue with exit-code carryover; I'll take a look soon.
from smoosh.
I took a look, it is. When run_command
returns with a Call
to step_eval
, the error code is still set to 1 and the error checking makes it fail. As far as I can tell, keeping the error code is the right thing to do:
$ tests/cmp/test.sh 'pe() { echo 0; }; false; pe'
smoosh: OUT [1] ERR [] EC [0]
bash-posix: OUT [1] ERR [] EC [0]
bash: OUT [1] ERR [] EC [0]
dash: OUT [1] ERR [] EC [0]
zsh-posix: OUT [1] ERR [] EC [0]
zsh: OUT [1] ERR [] EC [0]
osh: OUT [1] ERR [] EC [0]
mksh: OUT [1] ERR [] EC [0]
ksh: OUT [1] ERR [] EC [0]
yash-posix: OUT [1] ERR [] EC [0]
yash: OUT [1] ERR [] EC [0]
Making Call
a special case works and does not seem to break any of the working tests:
diff --git a/src/semantics.lem b/src/semantics.lem
index d838ca4..e8a221f 100644
--- a/src/semantics.lem
+++ b/src/semantics.lem
@@ -894,13 +894,18 @@ and step_eval s0 checked stmt =
not opts.force_simple_command &&
not (is_interactive s1)) (* per table in 2.8.1 *)
in
+ let is_call stms =
+ match stms with
+ | Call _ _ _ _ _ -> true
+ | _ -> false
+ end in
(* load exported variables, perform assignments *)
let env = Map.fromList assigns in
match run_command s1 opts checked prog args env with
| Right (s2, stmt', restore) ->
(XSSimple ("ran " ^ string_of_symbolic_string prog),
s2,
- if catching_errors && s2.sh.exit_code <> 0
+ if catching_errors && s2.sh.exit_code <> 0 && not (is_call stmt')
then Exit
else if restore
then pushredir stmt' saved_fds
But maybe there's a better way to fix this.
from smoosh.
It's not just functions: the Wait
that gets generated from actual commands also causes early exit.
$ set -e
$ false && true; /usr/bin/true
[EXIT]
I think the right solution is to only do the exit code test when stmt'
is Done
(and maybe other terminating control... will need to test).
from smoosh.
Related Issues (20)
- Indicate which tests failed HOT 1
- BUG_HDOCMASK in Modernish on Linux platforms. HOT 1
- sh_06.ex tp379 fails on Linux
- More faithful representation of words
- Implement `set -o pipefail`
- Issues with substring processing in parameter expansion HOT 10
- Show call stack/positional parameter info in Shtepper
- Packaging and build systems
- Broken POSIX tests in the VM: SIGTSTP?
- Clearer versioning HOT 2
- Fix test harness to be less fiddly HOT 1
- Building on macOS HOT 20
- Upgrade Modernish
- Explicit escaping throughout
- Implement other operations for arithmetic expansion
- Parser tests?
- Tool for just debugging ASTs
- Use libdash package and AST
- Separate builtin parsing and implementation
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 smoosh.