You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into weird issues of external C libraries interacting with a filesystem (nodefs) which would behave significantly differently depending on if I was building with --closure 1 or not.
After some troubleshooting, and some time looking at mangled code, I found out that the error handling was attempting to convert the full ERRNO code (as a string) against ERRNO_CODES dynamically, which does work when the code is not mangled, but breaks apart as soon as Closure kicks in and mangles the code names.
This results in operations like stat not behaving as expected (for instance, not returning an error on non-existing files), resulting in undefined behavior as the application behaves according to incorrect information about the state of the filesystem.
The text was updated successfully, but these errors were encountered:
cyyynthia
changed the title
Closure mangles ERRNO code names, but they are looked up dynamically
Closure mangles ERRNO code names, but they are looked up dynamically by nodefs
Jul 21, 2021
cyyynthia
added a commit
to cyyynthia/emscripten
that referenced
this issue
Jul 22, 2021
As described in #14705, errno codes may be looked up dynamically when
using nodefs, noderawfs and proxyfs, but closure was mangling the properties,
making some fs operations behave unexpectedly resulting in undefined behavior.
This quotes those names so closure leaves them as is.
Closes#14705
I ran into weird issues of external C libraries interacting with a filesystem (nodefs) which would behave significantly differently depending on if I was building with
--closure 1
or not.After some troubleshooting, and some time looking at mangled code, I found out that the error handling was attempting to convert the full ERRNO code (as a string) against
ERRNO_CODES
dynamically, which does work when the code is not mangled, but breaks apart as soon as Closure kicks in and mangles the code names.This results in operations like
stat
not behaving as expected (for instance, not returning an error on non-existing files), resulting in undefined behavior as the application behaves according to incorrect information about the state of the filesystem.Reproduction case
I made a small repository with a minimal reproduction case, with build/run instructions on the readme: https://github.com/cyyynthia/emscripten-fs-bug
Environment information
The text was updated successfully, but these errors were encountered: