Page 1 of 1

[0.14.7] [posila] Factorio crashes if executable directory is R/O

Posted: Mon Sep 19, 2016 7:00 pm
by Baughn
Although not all the time.

Method to reproduce:
- Put Factorio on a read-only filesystem
- Keep the config and mods in $HOME/.factorio, as is default.
- Attempt to toggle a mod on or off.

The game will crash, with these messages:

Code: Select all

  15.691 Info AppManager.cpp:643: Restarting Factorio
  15.692 Error Util.cpp:57: boost::filesystem::permissions: Read-only file system: "/home/svein/factorio/result/bin/factorio"
Judicious use of strace reveals that it doesn't attempt to write anything to the read-only filesystem, so there's no reason for the check. If it were removed, everything would just work. More correctly, it should only check for writability of the config directory.

===

Unrelated, but uncommon enough that you might not care, if the check succeeds Factorio will then attempt to restart. Unfortunately, it does so by executing /home/svein/factorio/result/bin/factorio ...

This is problematic, because for me that file is a NixOS-generated wrapper (full contents below), and since Factorio re-executes itself with all its parameters instact this is both pointless and -- because it doubles up on the -c parameter -- going to crash. It should re-execute argv[0], rather than assume that its executable is named factorio.

Code: Select all

#! /nix/store/x9z39620crc9d5lbrcsqzzsiifnsszql-bash-4.3-p46/bin/bash -e
export LD_LIBRARY_PATH=/run/opengl-driver/lib:/nix/store/2px33m9kzfy03kzfwanknfacnjn0cz9c-alsa-lib-1.1.1/lib:/nix/store/gz37rmvr8mbgnfsbgb35ggvrlpb81zcd-libX11-1.6.3/lib:/nix/store/py4v4ibh2953bh2k1ra7bqk4c229c7j0-libXcursor-1.1.14/lib:/nix/store/qkf6ahn5whib5kq141nv12nvibjny0p1-libXinerama-1.1.3/lib:/nix/store/f8x3jjqra8mx9xcyfh2qlsh7yjy3fn7c-libXrandr-1.5.0/lib:/nix/store/0k6jvngwvhk8fi7x7gw6xlgmgnnb7ys8-libXi-1.7.6/lib:/nix/store/vanw7c5srnzpj1l4jc5p3fm6b82al3xi-mesa-noglu-12.0.1/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
/nix/store/fmccn00a6h2f9qr4fsnyyai24dgsmyqv-factorio-alpha-0.13.13/share/factorio/update-config.sh
exec -a "$0" /nix/store/fmccn00a6h2f9qr4fsnyyai24dgsmyqv-factorio-alpha-0.13.13/bin/.factorio-wrapped -c $HOME/.factorio/config.cfg "${extraFlagsArray[@]}" "$@"
EDIT: Okay, so I just read the wrapper, and apparently makeWrapper is overriding argv[0] on purpose. I'm no longer sure what the correct fix would be.

Re: [0.14.7] [posila] Factorio crashes if executable directory is R/O

Posted: Thu Sep 22, 2016 2:42 pm
by posila
Thanks for the report.
If crashed on attempt to set execute permissions on the executable. That is there "just in case" for when restarting after Factorio update.
Fixed for next release.