node:fs: calling writeFileSync/appendFileSync with negative 0 causes an assertion failure
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in src/node_file.cc bei der in Zeile 2764 gemeldeten WriteFileUtf8-Assertion und verwende die Reproduktionen writeFileSync(-0, "") und appendFileSync(-0, ""). Verfolge, wie die fs-APIs das Pfadargument behandeln, und füge Testabdeckung für negative Null hinzu; abgeschlossen ist die Aufgabe, wenn keiner der beiden Aufrufe abbricht und sich beide wie positive Null verhalten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js
- Bereich
- backend, operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 65/100