`FileSystem.makeTempDirectory` crashes the program when it fails, instead of failing the task
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 86/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
- Ambito
- backend
Direzione di ricerca
Inizia da Gren/Kernel/FileSystem.js ed esegui la riproduzione collegata nell’issue con i gren.json e Main.gren mostrati. Traccia il callback di errore di fs.mkdtemp e verifica che gli errori non causino più un crash durante il parsing di un percorso undefined. Il lavoro è completato quando Task.onError riceve un FileSystem.Error il cui codice riflette l’errore sottostante, ad esempio ENOENT o EPERM.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- JavaScript
- Stelle
- 13
- Fork
- 6
- Merge medio
- 4g 12h
- PR unite (30g)
- 3
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di gren-lang/node
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
`ChildProcess.spawn` with `NoShell` looks for a program named after the program and its argumentsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
Tutte le issue di gren-lang/node
Issue simili
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
vercel/ai#21528 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
status: waiting triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
freeCodeCamp/freeCodeCamp#70412 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
rohitg00/ai-engineering-from-scratch#490 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 6 giorni