oilshell / oil

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.78k stars 150 forks source link

crash in parsing return #2003

Open andychu opened 1 week ago

andychu commented 1 week ago

Found by @dezren39

ysh ysh-0.22.0$ func y (;x) { return = x }
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/oil.py", line 34, in _cpython_main_hook
  File "/home/andy/git/oilshell/oil/bin/oils_for_unix.py", line 170, in main
  File "/home/andy/git/oilshell/oil/bin/oils_for_unix.py", line 137, in AppBundleMain
  File "/home/andy/git/oilshell/oil/core/shell.py", line 1034, in Main
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 219, in Interactive
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2739, in ParseInteractiveLine
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2580, in _ParseCommandLine
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2504, in ParseAndOr
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2515, in _ParseAndOr
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2463, in ParsePipeline
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2340, in ParseCommand
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2218, in ParseYshFunc
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 1309, in ParseBraceGroup
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2705, in _ParseCommandList
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2690, in _ParseCommandTerm
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2504, in ParseAndOr
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2515, in _ParseAndOr
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2463, in ParsePipeline
  File "/home/andy/git/oilshell/oil/osh/cmd_parse.py", line 2416, in ParseCommand
AssertionError: (Token
  id: Id.ControlFlow_Return
  length: 6
  col: 14
  line: (SourceLine line_num:118 content:"func y (;x) { return = x }\n" src:(source__Interactive))
  tval: return
)
FATAL: couldn't import from app bundle '/etc/profiles/per-user/user/bin/ysh' (1)
Stripping the oil.ovm binary may cause this error.
See https://github.com/oilshell/oil/issues/47
andychu commented 1 week ago

That was in #1997