Page 1 of 1

[0.17.18] Symlinks in script-output no longer work.

Posted: Tue Mar 26, 2019 12:30 pm
by L0laapk3
In past versions of the game, you were always able to create a symlink from script-output to another folder to explicitely allow mods to output to different locations. This is no longer possible, the game now first resolves the symlink and then realises its no longer inside script-output.

This is problematic because some mods produce large amounts of data (for example, FactorioMaps) and the default script-output directory is located in the users %appdata% folder on the main drive, which is usually a smaller SSD.


Steps to reproduce (on windows):
1. Open the script-output folder in cmd
2. Type 'mklink /J <src> <dest>' where src is a folder inside script-output, and dest is another folder (I have tested both symlinks to the same drive or another drive and neither of t hem work) (Neither the '/J' switch or '/D' switch work)
3. use game.write_file or similar function to write to that directory and observe it working succesfully in 0.16, but failing in 0.17.

Re: [0.17.18] Symlinks in script-output no longer work.

Posted: Tue Mar 26, 2019 3:58 pm
by quyxkh
They're being paranoid about where they'll allow file overwrites by arbitrary code their engine loads? ... yup, that's some paranoia-level constraint checking.

Good. These are mod-supplied file overwrites to mod-supplied paths, they _should_ be confined.

Users can specify the write-data directory in the config, and specify that on the command line/in the desktop shortcut.

Re: [0.17.18] Symlinks in script-output no longer work.

Posted: Tue Mar 26, 2019 8:44 pm
by L0laapk3
quyxkh wrote: Tue Mar 26, 2019 3:58 pm They're being paranoid about where they'll allow file overwrites by arbitrary code their engine loads? ... yup, that's some paranoia-level constraint checking.

Good. These are mod-supplied file overwrites to mod-supplied paths, they _should_ be confined.
The symlink would have to be made explicitely by the user anyways. It's the only way to have different portions of script-output to multiple different drives.

I'm not saying there shouldnt be any sanitization on the paths at all, theres just no reason for it to be context aware like this.

Re: [0.17.18] Symlinks in script-output no longer work.

Posted: Wed Mar 27, 2019 11:44 am
by Rseding91
Thanks for the report however I don't consider this a bug. I don't want scripts writing anything outside of the script output folder even if you symlink it to some other location.

Re: [0.17.18] Symlinks in script-output no longer work.

Posted: Wed Mar 27, 2019 2:30 pm
by L0laapk3
Rseding91 wrote: Wed Mar 27, 2019 11:44 am Thanks for the report however I don't consider this a bug. I don't want scripts writing anything outside of the script output folder even if you symlink it to some other location.
Can I ask why not? In the case that the symlink was created by a user, permission is already explicitely given. In the case that some malicious program would create the symlink, if a program can create a symlink, it can do far worse things already than what can be done from a factorio mod.

I am aware of the write-data config, but symlinks were the only way to differentiate output of mods to multiple different drives, what is the gain from removing such use cases?

Re: [0.17.18] Symlinks in script-output no longer work.

Posted: Wed Mar 27, 2019 2:46 pm
by SpeedFreak1
+1 for fixing the symlink issue.

I know its a fairly niche problem, but it does come in handy when using scripts that generate large amounts of data, eg. FactorioMaps, but also for people looking to move their data / save dir elsewhere via symlinks.

If a user has created a symlink themselves, i don't see why the factorio client should care.
Issues arising from the use of symlinks should be totally on the end user.

Re: [0.17.18] Symlinks in script-output no longer work.

Posted: Wed Jun 26, 2019 8:52 pm
by MrGrim
An independently configurable script output path would solve a lot of the issues involving mods with large output like FactorioMaps without requiring sacrificing Lua sandboxing. Perhaps that's an acceptable and hopefully easy to implement compromise?

Re: [0.17.18] Symlinks in script-output no longer work.

Posted: Thu Nov 28, 2019 2:32 am
by movax20h
Hi, I did hit a similar problem today in 0.17.99.

I want to make a symlink , because of amount of data being dumped by the mod, and I want to put it different place than standard location. I can't use bind mounts, and I am not sure if they would work either.

Re: [0.17.18] Symlinks in script-output no longer work.

Posted: Thu Nov 28, 2019 5:46 pm
by quyxkh
Factorio will follow symlinks for _reading_, just not for writing. If you've got a special mod that needs vast amounts of script-output space, set up a factorio runtime directory for it and put symlinks back to the factorio install's `bin` and `data` directories. If you're already relying on your users do manual setup, having them create a separate directory and install a symlink in their existing factorio runtime directory is less safe and not notably simpler than having them create a separate directory and install symlinks back to their existing runtime in that.

Re: [0.17.18] Symlinks in script-output no longer work.

Posted: Thu Nov 28, 2019 7:09 pm
by eradicator
Rseding91 wrote: Wed Mar 27, 2019 11:44 am I don't want scripts writing anything outside of the script output folder even if you symlink it to some other location.
That is some serious level paranoia/patronising to actively prevent the user from using intended filesystem features. Reminds me of all the broken games from the 90s that refuse to install on network drives even though they run just fine if you copy them to one after first installing to c:.