{"action":"created","issue":{"url":"https://api.github.com/repos/kripken/emscripten/issues/3229","labels_url":"https://api.github.com/repos/kripken/emscripten/issues/3229/labels{/name}","comments_url":"https://api.github.com/repos/kripken/emscripten/issues/3229/comments","events_url":"https://api.github.com/repos/kripken/emscripten/issues/3229/events","html_url":"https://github.com/kripken/emscripten/issues/3229","id":59978217,"number":3229,"title":"NODEFS flags conflict with Windows DELETE_ON_CLOSE / TEMPORARY / ...","user":{"login":"julien33","id":11335371,"avatar_url":"https://avatars.githubusercontent.com/u/11335371?v=3","gravatar_id":"","url":"https://api.github.com/users/julien33","html_url":"https://github.com/julien33","followers_url":"https://api.github.com/users/julien33/followers","following_url":"https://api.github.com/users/julien33/following{/other_user}","gists_url":"https://api.github.com/users/julien33/gists{/gist_id}","starred_url":"https://api.github.com/users/julien33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julien33/subscriptions","organizations_url":"https://api.github.com/users/julien33/orgs","repos_url":"https://api.github.com/users/julien33/repos","events_url":"https://api.github.com/users/julien33/events{/privacy}","received_events_url":"https://api.github.com/users/julien33/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-05T16:40:08Z","updated_at":"2015-03-09T20:17:05Z","closed_at":null,"body":"in src/library_nodefs.js function \"flagsToPermissionString\" :\r\nif flags contain unrecognized value, it is transmitted directly to :\r\nfs.openSync(path, NODEFS.flagsToPermissionString(stream.flags));\r\n\r\nbut some bit fields above the 16th bit, set for example by a compilation under linux (O_CLOEXEC)  have different meaning under windows, this one cause the file to be deleted on close for instance.\r\n\r\nOne solution would be to add a binary AND with 0xFFFF :\r\n\r\nflagsToPermissionString : function(flags)\r\n{\r\n        flags &= 0xFFFF;\r\n        if (flags in NODEFS.flagsToPermissionStringMap)\r\n        {\r\n                return NODEFS.flagsToPermissionStringMap[flags];\r\n        }\r\n        return flags;\r\n}\r\n\r\nThe problem was encountered while trying to use an improved version of sql.js from https://github.com/kripken/sql.js/ with direct file access.\r\nThe sqlite database file was deleted right after it was closed.\r\n"},"comment":{"url":"https://api.github.com/repos/kripken/emscripten/issues/comments/77932966","html_url":"https://github.com/kripken/emscripten/issues/3229#issuecomment-77932966","issue_url":"https://api.github.com/repos/kripken/emscripten/issues/3229","id":77932966,"user":{"login":"kripken","id":173661,"avatar_url":"https://avatars.githubusercontent.com/u/173661?v=3","gravatar_id":"","url":"https://api.github.com/users/kripken","html_url":"https://github.com/kripken","followers_url":"https://api.github.com/users/kripken/followers","following_url":"https://api.github.com/users/kripken/following{/other_user}","gists_url":"https://api.github.com/users/kripken/gists{/gist_id}","starred_url":"https://api.github.com/users/kripken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kripken/subscriptions","organizations_url":"https://api.github.com/users/kripken/orgs","repos_url":"https://api.github.com/users/kripken/repos","events_url":"https://api.github.com/users/kripken/events{/privacy}","received_events_url":"https://api.github.com/users/kripken/received_events","type":"User","site_admin":false},"created_at":"2015-03-09T20:17:05Z","updated_at":"2015-03-09T20:17:05Z","body":"Hmm, I have no idea what the \"right\" thing to do here is. I guess we would need to translate the emscripten flags (`O_CLEXEC`) etc. from the emscripten headers, to something that makes sense for the current native platform that node js running on? Is there a reason why `0xffff` is the right one, or is that just for windows?"}}