emscripten-core / emscripten-core/emscripten

mkfifo() and mknod() create regular file with NODERAWFS=1

Open
#16,158 1 comment 0 reactions 0 assignees View on GitHub
good first bug help wanted
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I noticed that mkfifo and mknod both create an empty regular file instead of a fifo.

**Version of emscripten/emsdk:**
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.1 (1934a98e709b57d3592b8272d3f1264a72c089e4)
clang version 14.0.0 (https://github.com/llvm/llvm-project f142c45f1e494f8dbdcc1bcf14122d128ac8f3fe)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /emsdk/upstream/bin
```

## reproducer

```
#include
#include
#include

int main(void)
{
unlink("testfifo");
mkfifo("testfifo", 0644);
return 0;
}
```

```
$ gcc -o mkfifo mkfifo.c && ./mkfifo
$ stat -c %F testfifo
fifo

$ strace -P testfifo ./mkfifo
strace: Requested path 'testfifo' resolved into '/python-wasm/cpython/builddir/testfifo'
unlink("testfifo") = 0
mknod("testfifo", S_IFIFO|0644) = 0
+++ exited with 0 +++
```

```
$ emcc -s NODERAWFS=1 -o mkfifo.js mkfifo.c && node ./mkfifo.js
$ stat -c %F testfifo
regular empty file

$ strace -P testfifo node ./mkfifo.js
strace: Requested path 'testfifo' resolved into '/python-wasm/cpython/builddir/testfifo'
unlink("testfifo") = 0
openat(AT_FDCWD, "testfifo", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 010644) = 17
close(17) = 0
+++ exited with 0 +++
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.