Repository navigation
Conversation
On POSIX _sopen is open(), so SH_DENYWR (which is 0) ended up as the file mode. Saves and configs were unreadable after writing them.
Xottab-DUTY
left a comment
There was a problem hiding this comment.
Labeling note: should be tagged "AI" and "External (3rd party)" - cannot set labels as an outside contributor.
Should be not. AI label only refers to the in-game AI code, which is inside xrGame/ai and xrAICore, not to AI agentic programming. I've renamed it to Game AI and changed the description accordingly.
External (3rd party) only applies to external dependencies (most of them lie in Externals folder). Since this PR edits engine's filesystem, it's not external at all.
| const int handle = _sopen(conv_fn, _O_WRONLY | _O_TRUNC | _O_CREAT | _O_BINARY, SH_DENYWR); | ||
| #ifdef XR_PLATFORM_WINDOWS | ||
| const int handle = _sopen(conv_fn, _O_WRONLY | _O_TRUNC | _O_CREAT | _O_BINARY, SH_DENYWR, _S_IREAD | _S_IWRITE); | ||
| #else |
There was a problem hiding this comment.
We need to make sure it is safe to set #else here.
Was it checked with other platforms?
I mean at least checking other platforms headers and/or their man documentation, to see if _sopen is a macro everywhere, or it's an actual function on some other non-Windows platforms also.
On POSIX
_sopenis#defined toopen(), and its third argument is thefile creation mode. So
SH_DENYWR(which is 0 on POSIX) became the mode,and everything the engine writes through
CFileWriter(saves, configs,logs) ended up with permissions 000. The engine then can't open its own
files back and dies, e.g. CoC aborts on startup with
can't open file ...\gamedata\configs\axr_options.ltxright afterwriting it.
Repro on Linux: start Call of Chernobyl, check the mode of
gamedata/configs/axr_options.ltx—----------.Pass the mode explicitly: 4-arg
_sopenon Windows, plain mode as thethird argument on POSIX.
Labeling note: should be tagged "AI" and "External (3rd party)" - cannot set labels as an outside contributor.