Page 1 of 1

[0.16.51] "Read only" stays when copying scenario to /temp

Posted: Fri Jul 27, 2018 11:49 am
by eradicator
What happend?
I wanted to load an old savegame, and got an error about reload_script() failing inside a migration and some log-spam.
The log spam also happens every time i press "Quit Game" (→to main menu).

Why does it happen?
So after some invenstigation i finally found that it's due to me having set a "read only" file-system flag on the whole factorio directory (this does not include the seperate /config folder). During runtime factorio copies those files verbatim to /temp, including the read-only flag. So when it later tries to overwrite or delete them it fails. I'm not sure why this happens when loading an old savegame, because i checked, and the save.zip doesn't have read-only flags on the files (assuming the zip is first extracted and then migrated). Removing the read-only flag from everything in \data\base\scenarios\freeplay, while keeping it on every other file "fixes" the problem, so that's definetly the cause.

I'm not sure if this is just "my setup is weird" or if you want to fix it...

Code: Select all

   0.002 Operating system: Windows 8
   0.003 Program arguments: "H:\factorio\base-data\latest\bin\x64\Factorio.exe" "--verbose" "--config" "H:\factorio\base-config\latest\config_tagewerk1.ini" "--mod-directory" "H:\factorio\base-config\latest\mods_tagewerk1"
   0.003 Read data path: H:/factorio/base-data/latest/data
   0.004 Write data path: H:/factorio/base-config/latest [11750/40959MB]
   0.004 Binaries path: H:/factorio/base-data/latest/bin

Code: Select all

        __base__/migrations/2018-01-09_Factorio_0.16.15.lua:1: in main chunk
 603.237 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\control.lua. Will set write permissions and try again
 603.237 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\af\freeplay.cfg. Will set write permissions and try again
 603.238 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\ar\freeplay.cfg. Will set write permissions and try again
 603.239 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\be\freeplay.cfg. Will set write permissions and try again
 603.239 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\bg\freeplay.cfg. Will set write permissions and try again
 603.239 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\ca\freeplay.cfg. Will set write permissions and try again
 603.240 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\cs\freeplay.cfg. Will set write permissions and try again
 603.240 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\da\freeplay.cfg. Will set write permissions and try again
 603.241 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\de\freeplay.cfg. Will set write permissions and try again
 603.241 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\el\freeplay.cfg. Will set write permissions and try again
 603.242 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\en\freeplay.cfg. Will set write permissions and try again
 603.242 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\eo\freeplay.cfg. Will set write permissions and try again
 603.243 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\es-ES\freeplay.cfg. Will set write permissions and try again
 603.244 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\et\freeplay.cfg. Will set write permissions and try again
 603.244 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\fi\freeplay.cfg. Will set write permissions and try again
 603.245 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\fr\freeplay.cfg. Will set write permissions and try again
 603.245 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\he\freeplay.cfg. Will set write permissions and try again
 603.246 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\hu\freeplay.cfg. Will set write permissions and try again
 603.246 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\it\freeplay.cfg. Will set write permissions and try again
 603.247 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\ja\freeplay.cfg. Will set write permissions and try again
 603.247 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\ko\freeplay.cfg. Will set write permissions and try again
 603.248 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\lt\freeplay.cfg. Will set write permissions and try again
 603.248 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\lv\freeplay.cfg. Will set write permissions and try again
 603.248 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\nl\freeplay.cfg. Will set write permissions and try again
 603.249 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\no\freeplay.cfg. Will set write permissions and try again
 603.249 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\pl\freeplay.cfg. Will set write permissions and try again
 603.250 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\pt-BR\freeplay.cfg. Will set write permissions and try again
 603.250 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\pt-PT\freeplay.cfg. Will set write permissions and try again
 603.250 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\ro\freeplay.cfg. Will set write permissions and try again
 603.251 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\ru\freeplay.cfg. Will set write permissions and try again
 603.251 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\sk\freeplay.cfg. Will set write permissions and try again
 603.252 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\sl\freeplay.cfg. Will set write permissions and try again
 603.252 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\sr\freeplay.cfg. Will set write permissions and try again
 603.253 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\sv-SE\freeplay.cfg. Will set write permissions and try again
 603.253 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\th\freeplay.cfg. Will set write permissions and try again
 603.253 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\tr\freeplay.cfg. Will set write permissions and try again
 603.254 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\uk\freeplay.cfg. Will set write permissions and try again
 603.254 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\vi\freeplay.cfg. Will set write permissions and try again
 603.255 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\zh-CN\freeplay.cfg. Will set write permissions and try again
 603.255 Warning FileUtil.cpp:383: Permission denied trying to remove H:\factorio\base-config\latest\temp\currently-playing\locale\zh-TW\freeplay.cfg. Will set write permissions and try again
 603.290 Error AppManagerStates.cpp:1301: Error while applying migration: Base Mod: 2018-01-09_Factorio_0.16.15.lua

Error while running reload_script: copy_file "H:/factorio/base-data/latest/data/base/scenarios/freeplay/control.lua" to "H:/factorio/base-config/latest/temp/currently-playing/control.lua" failed: operation not permitted
stack traceback:
        __base__/migrations/2018-01-09_Factorio_0.16.15.lua:1: in main chunk
migration_error.png
migration_error.png (187.33 KiB) Viewed 3596 times
migration_error2.png
migration_error2.png (56.4 KiB) Viewed 3596 times

Re: [0.16.51] "Read only" stays when copying scenario to /temp

Posted: Tue Aug 14, 2018 4:50 am
by Rseding91
I believe that's working as intended. On linux it copies the file/folder permissions when copying files around.

Re: [0.16.51] "Read only" stays when copying scenario to /temp

Posted: Tue Aug 14, 2018 7:21 am
by eradicator
Rseding91 wrote:I believe that's working as intended.
It's perfectly normal/feasible for the program folder to be read only, but it makes no sense that the currently active savegame starts out being unwritable. Especially because in most other circumstances factorio just goes ahead and removes the read-only flag on the second try, as can be seen in the log.

How about at least a more useful error message? I spent hours on fiddling with the actual permissions before i noticed that it's just the read-only flag...

Re: [0.16.51] "Read only" stays when copying scenario to /temp

Posted: Wed Apr 24, 2019 2:43 pm
by posila
Thanks for the report.
So, I thought about it and decided to make it so copying files doesn't preserve read-only permissions on Windows. On Linux/macOS it should not matter as parent folder needs to have a write permission to be able to delete files from it and we are not copying directory permissions.
Fixed for 0.17.33

Re: [0.16.51] "Read only" stays when copying scenario to /temp

Posted: Sat May 04, 2019 11:52 am
by eradicator
Thank you. :D