Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NODERAWFS: fstat() of unlinked file fails #66

Open
tiran opened this issue Mar 8, 2022 · 0 comments
Open

NODERAWFS: fstat() of unlinked file fails #66

tiran opened this issue Mar 8, 2022 · 0 comments

Comments

@tiran
Copy link
Collaborator

tiran commented Mar 8, 2022

Emscripten's fstat() fails with FileNotFoundError when the underlying file has been unlinked. The behavior breaks a handful of test cases.

import os

f = open("testfile", "w+")
f.write("test")
f.seek(0)
print(os.fstat(f.fileno()))
os.unlink(f.name)
print(f.read())
print(os.fstat(f.fileno()))
$ python test_fstat.py
os.stat_result(st_mode=33206, st_ino=10374816, st_dev=91, st_nlink=1, st_uid=0, st_gid=0, st_size=4, st_atime=1646767083, st_mtime=1646767083, st_ctime=1646767083)
test
os.stat_result(st_mode=33206, st_ino=10374816, st_dev=91, st_nlink=0, st_uid=0, st_gid=0, st_size=4, st_atime=1646767083, st_mtime=1646767083, st_ctime=1646767083)
$ ./run-python-node.sh fst.py 
os.stat_result(st_mode=33206, st_ino=10374816, st_dev=91, st_nlink=1, st_uid=0, st_gid=0, st_size=4, st_atime=1646765917, st_mtime=1646765917, st_ctime=1646765917)
test
Traceback (most recent call last):
  File "/python-wasm/fst.py", line 9, in <module>
    print(os.fstat(f.fileno()))
          ^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 44] No such file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant