Jump to content

[Bug] Saving map in Atlas not working


Recommended Posts

When trying to save ("save as...") a map into my home directory or to the suggested directory Atlas crashes (turns grey, does not respond etc)

Running Atlas using gdb '/usr/share/games/0ad/system/pyrogenesis_dbg' returns (after trying to save the map)

[...]
[New Thread 0xac15fb70 (LWP 2518)]
[Thread 0xac15fb70 (LWP 2518) exited]
[New Thread 0xac15fb70 (LWP 2519)]
[New Thread 0xab95eb70 (LWP 2520)]
file.cpp(61): Function call failed: return value was -110300 (Insufficient access rights to open file)
udbg_bfd_init: loading symbols from /usr/share/games/0ad/system/pyrogenesis_dbg.
terminate called after throwing an instance of 'PSERROR_File_WriteFailed'
what(): File_WriteFailed

Program received signal SIGABRT, Aborted.
0x0012d422 in __kernel_vsyscall ()

Edited by Quassy
Link to comment
Share on other sites

OK, so wopen (which just converts to UTF8 and calls open) is failing. Insufficient access rights is the usual cause, so we report that (*), but it needn't be that case here. Another possible reason is filesystem encoding - is it UTF8?

Could you please add some instrumentation to file.cpp, e.g. debug_printf(L"pathname: %ls\n", pathname.string().c_str()); before the wopen and debug_printf(L"errno: %d\n", errno); afterwards?

* It would be better to return LibError_from_errno(); and ensure all file-related errnos are included in an ERROR_ASSOCIATE (EACCES already is).

Link to comment
Share on other sites

Modifying the code like that would require compiling it manually and it wouldn't be run from the read-only system directory, so it's probably not the best way to debug it.

It'd be better to run

strace /usr/share/games/0ad/system/pyrogenesis_dbg -editor 2>&1|grep open

which will almost certainly give you output like

open("/usr/share/games/0ad/data/mods/public/maps/scenarios/test.pmp", O_WRONLY|O_CREAT|O_TRUNC, 0777) = -1 EACCES (Permission denied)

The problem is that the game uses the VFS mod-file system for loading and saving maps, so it always tries to put it in the shared data/mods/public/ directory, which is read-only in these installed packages. (It'd work fine with a version compiled by hand and running within your home directory). The scenario editor pretends to let you save in any location, but it's lying and always saves in data/mods/public/etc instead.

I think the right solution is to add a per-user mod (in ~/.local/share/0ad/data/mods/user/ or something) and make it the default for all file saving, and then make the Atlas UI be VFS-aware so it lets you select which mod to save files into (ignoring read-only ones) and see what files from the 'public' mod you're overriding. I expect it'll take quite a bit of effort to get a reasonable UI design for that (so that it makes sense, works for core game developers, works for mod developers, works for serious scenario designers, works for end users who are just playing with the tools, etc), and I haven't thought about it much - does anyone happen to have ideas for it?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...