Page 1 of 1

[0.13.12] Factorio errors on game.write_file

Posted: Sun Jul 31, 2016 5:14 pm
by Afforess
Bug: Factorio game.write_file('foo', 'bar') or any combination of API calls to game.write_file fails if the user has symlinked the script-output directory to another location. No mods are required to reproduce, console commands show the error as well.

Steps to reproduce:

1. Symlink (or Hardlink on Windows) factorio/script-output to another directory (say, /tmp)
2. Launch new Factorio map
3. In console, execute /c game.write_file('foo', 'bar')

Error:

Code: Select all

Cannot execute command. Error: [string "game.write_file('foo', 'bar')"]:1: Scripts can only use file space inside of /home/afforess/.factorio/script-output (requested path was /home/afforess/.factorio/script-output/foo)
Not sure what the best solution here is, but doing this generates a whole lot of errors when users try to run mods, and they blame it on mods, instead of themselves. ;)

Re: [0.13.12] Factorio errors on game.write_file

Posted: Sun Jul 31, 2016 6:07 pm
by Rseding91
The solution: don't symlink script-output to a different folder.

The actual solution: we don't have one yet. The file system library we use doesn't work correctly with symlinks. It's a known issue.

Re: [0.13.12] Factorio errors on game.write_file

Posted: Mon Aug 01, 2016 2:52 am
by Afforess
Rseding91 wrote:The solution: don't symlink script-output to a different folder.
*Points at silly users.*

I agree completely.
Rseding91 wrote:The actual solution: we don't have one yet. The file system library we use doesn't work correctly with symlinks. It's a known issue.
Yeah. I've got no easy answers either.

Re: [0.13.12] Factorio errors on game.write_file

Posted: Mon Aug 01, 2016 9:20 am
by prg
Afforess wrote:
Rseding91 wrote:The solution: don't symlink script-output to a different folder.
*Points at silly users.*
Tell them to use a bind mount instead.

Re: [0.13.12] Factorio errors on game.write_file

Posted: Fri Aug 05, 2016 3:46 pm
by posila
This might be solved in 0.13.14. I know for sure it is solved on Windows ... don't know about other platforms.
Let us know, if it is still problem in 0.13.14

Re: [0.13.12] Factorio errors on game.write_file

Posted: Fri Feb 17, 2017 8:26 am
by pond247
For Linux (in my case Arch Linux 64bi) the issue still exists in 14.22.

Re: [0.13.12] Factorio errors on game.write_file

Posted: Fri Feb 17, 2017 11:12 am
by cube
I can't reproduce this on my machine. Could you please post complete log file?