emscripten-core / emscripten-core/emscripten
fread returns garbage when pipe is closed
- Vorherrschende Sprache
- C++
- Sterne
- 27.6k
- Forks
- 3.6k
- Ø Merge
- 1 T. 14 Std.
- Gemergte PRs (30 T.)
- 125
Beschreibung
On Windows, when content provided on the stdin pipe is read and pipe is closed, the following code throws with errno equal to `undefined` and `fread` keeps returning data instead of indicating EOF.
https://github.com/emscripten-core/emscripten/blob/0589ed2211831fe74c5b340de544b3d5d9fe5388/src/library_syscall.js#L150
```
ErrnoError
at Object.ensureErrnoError (C:\***\a.out.js:11068:35)
at Object.staticInit (C:\***\a.out.js:11076:12)
at Object. (C:\***\a.out.js:12037:6)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
node: undefined,
setErrno: [Function],
errno: undefined,
message: 'FS error'
```
Beitragsleitfaden
Rechercherichtung
Start with src/library_syscall.js around the linked line and reproduce the Windows stdin-pipe case described in the issue. Check how a closed pipe is translated into errno and EOF, then verify that fread stops returning data and the error no longer has an undefined errno.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, wasm
- Bereich
- operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100