nushell/crates
TrMen 4b91ed57dd
Enforce call stack depth limit for all calls (#11729)
# Description
Previously, only direcly-recursive calls were checked for recursion
depth. But most recursive calls in nushell are mutually recursive since
expressions like `for`, `where`, `try` and `do` all execute a separte
block.

```nushell
def f [] {
    do { f }
}
```
Calling `f` would crash nushell with a stack overflow.

I think the only general way to prevent such a stack overflow is to
enforce a maximum call stack depth instead of only disallowing directly
recursive calls.

This commit also moves that logic into `eval_call()` instead of
`eval_block()` because the recursion limit is tracked in the `Stack`,
but not all blocks are evaluated in a new stack. Incrementing the
recursion depth of the caller's stack would permanently increment that
for all future calls.

Fixes #11667

# User-Facing Changes
Any function call can now fail with `recursion_limit_reached` instead of
just directly recursive calls. Mutually-recursive calls no longer crash
nushell.

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
2024-02-08 06:42:24 +08:00
..
nu_plugin_custom_values bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu_plugin_example bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu_plugin_formats bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu_plugin_gstat bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu_plugin_inc bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu_plugin_python remove vectorize_over_list from python plugin (#9905) 2023-08-03 16:46:48 +02:00
nu_plugin_query bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-cli bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-cmd-base bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-cmd-dataframe bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-cmd-extra bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-cmd-lang bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-color-config bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-command Enforce call stack depth limit for all calls (#11729) 2024-02-08 06:42:24 +08:00
nu-engine Enforce call stack depth limit for all calls (#11729) 2024-02-08 06:42:24 +08:00
nu-explore bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-glob bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-json bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-lsp bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-parser Enforce call stack depth limit for all calls (#11729) 2024-02-08 06:42:24 +08:00
nu-path bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-plugin bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-pretty-hex bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-protocol Enforce call stack depth limit for all calls (#11729) 2024-02-08 06:42:24 +08:00
nu-std bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-system bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-table bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-term-grid bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-test-support bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
nu-utils bump to dev release of nushell 0.90.2 (#11793) 2024-02-07 16:26:03 -06:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.