`FileSystem.makeTempDirectory` crashes the program when it fails, instead of failing the task
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 86/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu với Gren/Kernel/FileSystem.js và chạy bản tái hiện được liên kết trong issue bằng gren.json và Main.gren đã cho. Theo dõi callback thất bại của fs.mkdtemp và xác minh rằng các lỗi không còn gây crash khi phân tích cú pháp một đường dẫn undefined. Được xem là hoàn tất khi Task.onError nhận được một FileSystem.Error có code phản ánh lỗi nền tảng, chẳng hạn như ENOENT hoặc EPERM.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Found against: gren 0.6.6, gren-lang/core 7.4.2, gren-lang/node 6.1.3, node 22
Reproduction: https://github.com/gilramir/gren-bug-reports/tree/main/2026-09-14-maketempdirectory-failure
FileSystem.makeTempDirectory is a Task FileSystem.Error Path, but when node
cannot make the directory the program dies with The "path" argument must be of type string. Received undefined and the program's Task.onError never runs.
Expected: the task fails with an Error whose code is ENOENT (or EPERM, etc). Any failure
reaches it: a missing parent directory, a prefix naming a directory the user
cannot write, or a full temporary directory.
Reproduction
gren.json dependencies: gren-lang/core 7.4.2, gren-lang/node 6.1.3. Save as src/Main.gren. Build and run with gren make Main --output=app && node app:
module Main exposing (main)
import FileSystem
import FileSystem.Path as Path
import Init
import Node
import Stream
import Task
main : Node.SimpleProgram a
main =
Node.defineSimpleProgram <| \env ->
Init.await FileSystem.initialize <| \fs ->
Node.endSimpleProgram
(FileSystem.makeTempDirectory fs "no-such-directory/x"
|> Task.map (\path -> "made " ++ Path.toPosixString path)
|> Task.onError (\e -> Task.succeed ("failed: " ++ FileSystem.errorCode e))
|> Task.andThen (\line -> Stream.writeLineAsBytes line env.stdout)
|> Task.onError (\_ -> Task.succeed env.stdout)
)
Output:
$ node app
node:internal/errors:540
throw error;
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at Object.normalize (node:path:1309:5)
at _FilePath_parse (/path/to/app:2889:40)
at _FilePath_fromString (/path/to/app:2885:10)
at /path/to/app:3664:40
at FSReqCallback.oncomplete (node:fs:186:23) {
code: 'ERR_INVALID_ARG_TYPE'
}
Node.js v22.23.2
Cause
Gren/Kernel/FileSystem.js:
fs.mkdtemp(path.join(os.tmpdir(), prefix), function (err, dir) {
if (err) {
callback(
__Scheduler_fail(
_FileSystem_constructError(__FilePath_fromString(dir), err),
),
);
On failure dir is undefined, and __FilePath_fromString(undefined) calls
path.normalize(undefined), which throws inside node's callback, where nothing
catches it.
- Ngôn ngữ chính
- JavaScript
- Star
- 13
- Fork
- 6
- Merge trung bình
- 4 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 gren-lang/node
-
`ChildProcess.spawn` with `NoShell` looks for a program named after the program and its argumentsĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Tất cả issue của gren-lang/node
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
curriculum documentation quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
githubnext/gh-aw-workshop#3897 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 91/100
Maintainer thường phản hồi trong vòng 1 ngày