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

Things that we don't consider worth fixing at this moment.
L0laapk3
Inserter
Inserter
Posts: 49
Joined: Sun Mar 18, 2018 10:01 pm
Contact:

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

Post 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.
quyxkh
Smart Inserter
Smart Inserter
Posts: 1031
Joined: Sun May 08, 2016 9:01 am
Contact:

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

Post 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.
L0laapk3
Inserter
Inserter
Posts: 49
Joined: Sun Mar 18, 2018 10:01 pm
Contact:

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

Post 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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14611
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.
L0laapk3
Inserter
Inserter
Posts: 49
Joined: Sun Mar 18, 2018 10:01 pm
Contact:

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

Post 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?
Last edited by L0laapk3 on Wed Mar 27, 2019 3:29 pm, edited 1 time in total.
SpeedFreak1
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Oct 03, 2018 5:17 am
Contact:

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

Post 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.
User avatar
MrGrim
Fast Inserter
Fast Inserter
Posts: 244
Joined: Sat Apr 09, 2016 7:58 pm
Contact:

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

Post 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?
movax20h
Fast Inserter
Fast Inserter
Posts: 164
Joined: Fri Mar 08, 2019 7:07 pm
Contact:

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

Post 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.
quyxkh
Smart Inserter
Smart Inserter
Posts: 1031
Joined: Sun May 08, 2016 9:01 am
Contact:

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

Post 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.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

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

Post 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:.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Post Reply

Return to “Won't fix.”