Node repl crashes when trying to call back a large multiline item

未关闭
#59,431 9 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
javascript, linux, node.js
领域
cli

调研方向

首先,使用一个较大的多行 JSON 项在 Node REPL 中重现崩溃,然后检查 internal/readline/interface 中的 _multilineMove 和 _moveUpOrHistoryPrev,以及 node:repl。重复两次向上箭头操作后不会抛出报告中的 TypeError,也不会导致 REPL 崩溃,即表示完成。

由索引模型根据 Issue 内容生成。

描述

confirmed-bug readline repl
Version

24.4.1

Platform
Linux panta-rog 6.14.0-27-generic #27-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 17:01:58 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Subsystem

No response

What steps will reproduce the bug?

Paste a huge multi-line JSON into repl.
Then bring it back via arrow up.
Then press arrow up again.

How often does it reproduce? Is there a required condition?

I can reproduce it with a long JSON.

What is the expected behavior? Why is that the expected behavior?

No crash.

What do you see instead?
TypeError: Cannot read properties of undefined (reading 'length')
    at REPLServer.[_multilineMove] (node:internal/readline/interface:1092:36)
    at REPLServer.[_moveUpOrHistoryPrev] (node:internal/readline/interface:1149:27)
    at REPLServer.[_ttyWrite] [as _ttyWrite] (node:internal/readline/interface:1498:37)
    at REPLServer.self._ttyWrite (node:repl:1035:9)
    at ReadStream.onkeypress (node:internal/readline/interface:284:20)
    at ReadStream.emit (node:events:507:28)
    at ReadStream.emit (node:domain:489:12)
    at emitKeys (node:internal/readline/utils:371:14)
    at emitKeys.next (<anonymous>)
    at ReadStream.onData (node:internal/readline/emitKeypressEvents:64:36)
Additional information

No response

主要语言
JavaScript
星标
122k
派生
37.4k
平均合并
4 天 3 小时
30 天内合并 PR
272

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nodejs/node 的其他 Issue

查看 nodejs/node 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。