node:fs: calling writeFileSync/appendFileSync with negative 0 causes an assertion failure
オープン
まだ誰も着手していません。
fs
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
Version
v26.8.1
Platform
Linux nixdesk 6.18.48 #1-NixOS SMP PREEMPT_DYNAMIC Fri Aug 28 06:22:54 UTC 2026 x86_64 GNU/Linux
Subsystem
fs
What steps will reproduce the bug?
require("node:fs").writeFileSync(-0, "")
or
require("node:fs").appendFileSync(-0, "")
How often does it reproduce? Is there a required condition?
it always happens on my machine. i have not tried on any other computer or os
What is the expected behavior? Why is that the expected behavior?
for it to do the same thing as positive zero i assume
What do you see instead?
❯ echo 'require("node:fs").writeFileSync(-0, "")' | node -
# node[264400]: void node::fs::WriteFileUtf8(const v8::FunctionCallbackInfo<v8::Value>&) at ../../src/node_file.cc:2764
# Assertion failed: (*path) != nullptr
----- Native stack trace -----
1: 0x629c801c0228 [node]
2: 0x629c801c0b97 node::Assert(node::AssertionInfo const&) [node]
3: 0x629c801cda7b [node]
4: 0x729babdcfae9
----- JavaScript stack trace -----
1: writeFileSync (node:fs:2997:20)
2: [stdin]:1:20
3: runScriptInThisContext (node:internal/vm:219:10)
4: node:internal/process/execution:485:12
5: [stdin]-wrapper:6:24
6: runScriptInContext (node:internal/process/execution:483:60)
7: evalFunction (node:internal/process/execution:317:30)
8: evalTypeScript (node:internal/process/execution:329:3)
9: node:internal/main/eval_stdin:51:5
10: node:internal/process/execution:239:5
fish: Job 1, 'echo 'require("node:fs").writeF…' terminated by signal SIGABRT (Abort)
Additional information
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
src/node_file.cc の、2764 行目で報告された WriteFileUtf8 アサーションの周辺から始め、writeFileSync(-0, "") と appendFileSync(-0, "") の再現を使います。fs API がパス引数をどのように処理するかを追跡し、負のゼロのカバレッジを追加します。完了の条件は、どちらの呼び出しも異常終了せず、両方が正のゼロと同じように動作することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- backend, operating-systems
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 65/100