Open Praveer1981 opened 4 years ago
As a regression, I'd recommend doing a bisection to find the version in which this regressed. That's usually the fastest way to make progress, if there isn't an obvious explanation for the problem (which I don't see myself).
@kripken Thanks for your response , let me find out the version in which it was regressed
I verified and found that the regression is from 1.39.9 version of emscripten.
I tried to run the same program using compiler_explorer. I used Clang trunk(which I assume is Clang 12) and got the correct output(which is Perm = 32
)
Thanks @Praveer1981
Looks like this from the Changelog is the likely cause:
- Updated of libc++abi and libc++ to llvm 9.0.0 (#10510)
This may be a regression in libc++, or perhaps the old behavior was wrong before. Next step, I would check if the problem happens in a non-emscripten build of that libc++ version, and if it fails too, if it happens on libc++ trunk (it may have been fixed).
@kripken Currently, I do not see any test for the filesystem's APIs, Does it make sense to add the tests for the APIs which will help to catch the regression in the future ?
Hopefully its enough to test the underlying C APIs and syscalls that are used by the C++ API. I don't think we need to be testing the C++ API directly.. but you might need to use it isolate the exact syscall that broke in this case.
As far as I'm aware emscripten doesn't really support file permissions per-say, it just fakes them, so maybe its easier to fix your application to ignore them which would be more correct and efficient when running on emscripten.
Thanks @Praveer1981
Looks like this from the Changelog is the likely cause:
- Updated of libc++abi and libc++ to llvm 9.0.0 (#10510)
This may be a regression in libc++, or perhaps the old behavior was wrong before. Next step, I would check if the problem happens in a non-emscripten build of that libc++ version, and if it fails too, if it happens on libc++ trunk (it may have been fixed).
@kripken Did you get chance to check if the problem happens in a non-emscripten build of that libc++ version ?
@Praveer1981 I don't think I personally have the time to do that, sorry.
@sbc100 looks like it might be caused by this -> https://github.com/emscripten-core/emscripten/pull/10474/files
the function in library_syscall.js,
this is the output of the test in https://github.com/emscripten-core/emscripten/pull/13581
__sys_fchmodat: function(dirfd, path, mode, varargs) {
err('warning: untested syscall');
path = SYSCALLS.getStr(path); path = SYSCALLS.calculateAt(dirfd, path); // mode was 16 mode = SYSCALLS.get(); // mode becomes 0 FS.chmod(path, mode); return 0; }
maybe i should create a new issue. getting the permissions actually works on 2.0.14 +, but changing permissions dont.
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.
Hi, I see the different behavior of permissions() function in
1.39.7
and2.0.8
Below is the sample Code:
I get below output in
1.39.7
perm =32
std::filesystem::perms::group_read = 32 I get below output in2.0.8
perm =0
std::filesystem::perms::group_read = 32The perm value = 0 means no permission set. However, I had set the permission
Here is the command I used to build and run:
reference: https://en.cppreference.com/w/cpp/experimental/fs/perms
Is there anything I am doing wrong here.