Skip to content

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

Description

@tiran

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 <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

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 +++

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions