[0.13.1] Can't save to readonly save

Bugs that are actually features.
Post Reply
Killerbee
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Thu Mar 17, 2016 8:44 pm
Contact:

[0.13.1] Can't save to readonly save

Post by Killerbee »

The game is unable to save to readonly saves.
I discovered this after I downloaded a save from the forum.
When I removed the readonly flag from the file I was able to save again.

You will probably have to combine these stackoverflow answers:
http://stackoverflow.com/questions/1255 ... ess-on-nix
http://stackoverflow.com/questions/7913 ... a-file-mfc

Into something like this:
if (!access(name, W_OK)) {
SetFileAttributes(name, GetFileAttributes(name) & ~FILE_ATTRIBUTE_READONLY);
}

Shadowkeeper256
Burner Inserter
Burner Inserter
Posts: 8
Joined: Thu Jun 30, 2016 4:56 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Shadowkeeper256 »

Isn't that what read-only is supposed to do?

Killerbee
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Thu Mar 17, 2016 8:44 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Killerbee »

It is, except when it is unintended, like when I download a save and want to continue with it.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Adil »

Well, it's not factorio that sets that flag. And file access control isn't performed by the game as well.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

Loewchen
Global Moderator
Global Moderator
Posts: 8318
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Loewchen »

I am a bit lost, if you expect to be able to save to a file or directory that is read only, then your expectations are the problem. Or am I misunderstanding you?

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Oxyd »

Can't reproduce.

Killerbee
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Thu Mar 17, 2016 8:44 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Killerbee »

My expectation is that I can download a savegame, place it in the saves map and can continue playing with it.
Currently that isn't possible because Factorio doesn't take control of the file which gives errors like this:
Image
Attachments
factorio-current.log
(2.42 KiB) Downloaded 87 times

Shadowkeeper256
Burner Inserter
Burner Inserter
Posts: 8
Joined: Thu Jun 30, 2016 4:56 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Shadowkeeper256 »

So your expectation is that the game overrides the OS's restriction on files that have been set read-only? ... (and by from what you've said so far are locked down due to ownership-lockdown, also an OS feature to protect you as a user ...)

Killerbee
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Thu Mar 17, 2016 8:44 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Killerbee »

It isn't much of a protection mechanism because it is already too late if the game opens a savegame with an exploit.

But if people are worried about it why not implement something like in Microsoft Word, it will prompt the user if it want to edit the file the downloaded file.
Factortio can ask a question like: "This savegame is marked as readonly, are you sure you want to overwrite it?"

Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Zeblote »

The problem here is that your file is marked as read-only. That does NOT happen by just placing a downloaded file in the folder.

Maybe right click the factorio folder in appdata and apply read-only off for all subfolders just to be sure.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Rseding91 »

I download save files *allllll the time* to look at peoples saves from bug reports and never once have had this issue.

It sounds like you've got some permissions issue wrong on your computer or maybe an antivirus software is changing downloads to read-only.
If you want to get ahold of me I'm almost always on Discord.

User avatar
y.petremann
Filter Inserter
Filter Inserter
Posts: 407
Joined: Mon Mar 17, 2014 4:24 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by y.petremann »

For my case I think that the game is doing right, a readonly file shouldn't be overwritable that easy, I think that a user error and to show that, I think that you should put a message directed toward the player about his file being readonly and having him to set write permissions manually or saving to another name.

Killerbee
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Thu Mar 17, 2016 8:44 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Killerbee »

If you refuse to solve this issue at least make the message readable for the average user.
And preferably with some explanation to the user how to remove the readonly permission.

Tychon
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Jul 01, 2016 11:13 am
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Tychon »

Killerbee wrote:It isn't much of a protection mechanism because it is already too late if the game opens a savegame with an exploit.
read only does not mean a save file cannot be read so it isn't any exploit or whatever.
Killerbee wrote:But if people are worried about it why not implement something like in Microsoft Word, it will prompt the user if it want to edit the file the downloaded file.
Factortio can ask a question like: "This savegame is marked as readonly, are you sure you want to overwrite it?"
Word also cannot edit a read only file. The read only mark can ONLY be changed by the OS. Nothing else. What Word offers you is to create a copy but it cannot edit a read only file.

Killerbee
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Thu Mar 17, 2016 8:44 pm
Contact:

Re: [0.13.1] Can't save to readonly save

Post by Killerbee »

Tychon wrote:
Killerbee wrote:It isn't much of a protection mechanism because it is already too late if the game opens a savegame with an exploit.
read only does not mean a save file cannot be read so it isn't any exploit or whatever.
Killerbee wrote:But if people are worried about it why not implement something like in Microsoft Word, it will prompt the user if it want to edit the file the downloaded file.
Factortio can ask a question like: "This savegame is marked as readonly, are you sure you want to overwrite it?"
Word also cannot edit a read only file. The read only mark can ONLY be changed by the OS. Nothing else. What Word offers you is to create a copy but it cannot edit a read only file.
You obviously didn't understand my exploit comment.
Someone said it is part of a protection of the OS, which isn't the case.
When the save is corrupted, for example a string says it's 700 characters long while it in reality is only 30 characters long a badly programmed program will still try to read those missing 670 characters.
This can be used to crash programs, execute abitrary code etc.
The game will load the save regardless of the readonly flag, so when something like that is in the save and the savegame loading code is bad it will offer no protection.

Your comment about only the OS can change the flag isn't true as you could have seen in my first comment.
I've also tested in same code it wrote myself and I can easily remove the readonly flag without admin rights.
Just checked it in word, and it appears I was wrong, it doesn't change the readonly flag, but at least it gives a clean error.

Post Reply

Return to “Not a bug”