node:fs: calling writeFileSync/appendFileSync with negative 0 causes an assertion failure
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend, operating-systems
Hướng nghiên cứu
Bắt đầu tại src/node_file.cc, xung quanh assertion WriteFileUtf8 được báo cáo ở dòng 2764, bằng cách sử dụng các trường hợp tái hiện writeFileSync(-0, "") và appendFileSync(-0, ""). Theo dõi cách các API fs xử lý đối số path và thêm coverage cho số không âm; hoàn thành khi cả hai lệnh gọi đều không bị abort và đều hoạt động như số không dương.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- JavaScript
- Star
- 122k
- Fork
- 37.4k
- Merge trung bình
- 4 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 273
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nodejs/node
-
doc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
build
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Daemon passes --experimental-wasm-jspi unconditionally on Node >= 24; Node 26 rejects the flag Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Automattic/studio#4908 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
sugarlabs/musicblocks#8847 ·