oils-for-unix / oils

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.85k stars 159 forks source link

crash in parsing return #2003

Closed andychu closed 2 weeks ago

andychu commented 5 months 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 5 months ago

That was in #1997

andychu commented 2 weeks ago

Released - https://www.oilshell.org/blog/2024/11/release-0.23.0.html