Skip to content

Commit 8438843

Browse files
authored
[spec/divergence] Add case for nested subshell like ((echo ... (#2399)
gzip has a utility script called zdiff. It gets used at some point in the check step when building gzip from source. It also makes use of nested subshells in a few places. The osh parser is tripping over these. Here's an example from a simple script. ((echo foo) | tr o 0) ^~~ _tmp/foo.sh:1: Unexpected token after arithmetic expression (Id.Word_Compound != Id.Arith_RParen) Other shells seem to handle this case, so in preparation for an inbound fix, this commit adds a new spec test to cover it.
1 parent d90601e commit 8438843

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

spec/divergence.test.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## compare_shells: bash dash mksh zsh ash
2-
## oils_failures_allowed: 2
2+
## oils_failures_allowed: 3
33

44
# This file relates to:
55
#
@@ -55,3 +55,11 @@ bad
5555
5656
## STDOUT:
5757
## END
58+
59+
#### Nested subshell (#2398)
60+
61+
# found on line 137 of the zdiff util from gzip
62+
((echo foo) | tr o 0)
63+
## STDOUT:
64+
f00
65+
## END

0 commit comments

Comments
 (0)