louisdh / openterm

OpenTerm, a sandboxed command line interface for iOS
Other
1.63k stars 249 forks source link

awk dies trying to access NF #163

Open adbennet opened 6 years ago

adbennet commented 6 years ago

simple test case $ awk -- '{print NR;}' foo bar ^C 1 2 $ awk -- '{print NF;}' foo bar ^C ==FATAL On looking at this again, it actually prints out NF before dying.

$ awk -- '{print NF;} END {print "bye";}' foo bar ^C 2 bye ==FATAL

holzschu commented 6 years ago

I can reproduce the issue. It's related to the memory reset at the end of awk (the freeTree function in run.c). I'm investigating.

holzschu commented 6 years ago

I've submitted a partial fix on https://github.com/holzschu/ios_system You'll have to recompile and sideload (obviously), and it's not 100% robust yet, but it crashes less often.