JS: mode flags in stat struct are different across host platforms
I was investigating the CI failures for JavaScript, and found another issue, testing on macOS.
In h$base_fillStat
in jsbits/base.js
, we fill the fs_mode
field with the file mode from nodejs, which comes from the host platform. Accessors that use JavaScript to test for file types work correctly, since we use h$fs.constants
to test the file type bits, which match the ones from the host platform.
But some Haskell code accesses the mode bits directly, using an .hsc
file: System/Posix/Files/Common.hsc
, and that gives the wrong filetypes on macOS.
Fix: we should convert the mode field before inserting it in the struct stat to match the values that the C compiler accepts.