reedline / repl panic when typing a specific `alias`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 85
Description
Describe the bug
~/.s/sessions/03B..PLM/xs $ view source and-then
if ($in | is-not-empty)
~/.s/sessions/03B..PLM/xs $ and-theError: × Main thread panicked.
├─▶ at crates/nu-protocol/src/engine/state_working_set.rs:774:13
╰─▶ Attempt to mutate a block that is in the permanent (immutable) state
help: set the `RUST_BACKTRACE=1` environment variable to display a backtrace.
Doing a git bisect, it looks like this issue was introduced with PR: https://github.com/nushell/nushell/pull/13357
How to reproduce
At the repl:
- alias and-then = if ($in | is-not-empty)
- and-then
Expected behavior
not panic
Screenshots
https://github.com/user-attachments/assets/e096925b-a3dc-4275-9cd5-d6a1f5e07388
Configuration
| key | value |
|---|---|
| version | 0.97.1 |
| major | 0 |
| minor | 97 |
| patch | 1 |
| branch | |
| commit_hash | 60769ac1ba3ea036d889f140095d855e5597840c |
| build_os | macos-aarch64 |
| build_target | aarch64-apple-darwin |
| rust_version | rustc 1.78.0 (9b00956e5 2024-04-29) |
| rust_channel | 1.78.0-aarch64-apple-darwin |
| cargo_version | cargo 1.78.0 (54d8815d0 2024-03-26) |
| build_time | 2024-08-21 14:04:19 -04:00 |
| build_rust_channel | debug |
| allocator | mimalloc |
| features | default, sqlite, system-clipboard, trash |
| installed_plugins | example, from_sse, http 0.1.0, query 0.95.1, stateful_filter 0.1.0 |
Additional context
The alias still works when used in scripts, so it appears to only be an issue with an interaction with reedline / the repl.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the panic in the REPL with alias and-then = if ($in | is-not-empty) followed by and-then, then inspect crates/nu-protocol/src/engine/state_working_set.rs around line 774 and the reedline/REPL interaction. Done means the alias continues to work interactively without attempting to mutate a permanent immutable block, while retaining the existing script behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100