Page 1 of 1
[2.0.25] Unzipped saves from year 1601
Posted: Fri Dec 13, 2024 4:17 pm
by eugenekay
Unzipping a Save file (to experiment with control.lua / freeplay.lua) results in time travel to the year 1601.
This is the same as the
Win32 Epoch date, of January 1, 1601.
What did you do?
- Create a Savegame file
- In Windows' File Explorer, Navigate to %appdata%/Factorio/saves/
- Right-click --> Extract all; select the "saves" folder so there is not a nested saves/SpaceAge4/SpaceAge4/ directory
- In Factorio, open the Load Game dialog
What happened?
- Metadata for the "Save Folder" shows the date as "423 years ago". File size is "0.0MB"
What did you expect to happen instead? It might be obvious to you, but do it anyway!
- Age of the save should be same or close to the files' "Date modified" as seen in File Explorer
- File Size would be the same as "Size" in Folder Properties (this requires walking the directory tree with Get-ChildItem or `du` on Linux; may not be feasible)
Does it happen always, once, or sometimes?
- When attempting to load a "Save Folder" instead of a "Save File"
I have not tested this on Linux yet; I would expect to see similar results, but with the UNIX Epoch date (January 1, 1970) instead.
Re: [2.0.25] Unzipped saves from year 1601
Posted: Fri Dec 13, 2024 5:13 pm
by boskid
Thanks for the report however i do not care. Also Factorio does not have any tools to extract zip to a directory and when i tested 7zip all the timestamps were correct (well, zip does not have any timestamps inside). It was only when extracting a zip file using windows explorer. Would you like to forward your bug report to microsoft instead?
Re: [2.0.25] Unzipped saves from year 1601
Posted: Fri Dec 13, 2024 5:15 pm
by eugenekay
I used to work at Microsoft. I reported a lot of things that did not get fixed
Yes, I noticed that Factorio creates “invalid zip files”, according to some tools. The unzipped files have a Modified Date of “now”, and seem valid otherwise.
But, this Bug Report was for the fact that Factorio does not respect the “folders’” modified Date; not for the contents of the Zip itself.
Not a big deal, just an interesting observation that Factorio is getting a “0” value for the Timestamp of the folder, rather than the actual Modified Date, and then proceeds to cast this (Correctly) to a Gregorian date, which happens to be 1601 in Windows.
Re: [2.0.25] Unzipped saves from year 1601
Posted: Fri Dec 13, 2024 9:42 pm
by Rseding91
We use the minizip library with zlib and it does what ever it wants to do. We don’t do anything with time stamps anywhere that I know of. You can complain to them if you like.
Re: [2.0.25] Unzipped saves from year 1601
Posted: Fri Dec 13, 2024 9:51 pm
by eugenekay
Sorry, I think we have a misunderstanding as to what is being Reported? The Savegame ZIP file itself is
fine, I can open it, read contents out of it, works great. The ZIP format is one of the oldest in Computer Science, and decompressors have learned to be very tolerant of missing metadata.
The problem is that the Game is attempting to Read the Modified Date for the FOLDER "SpaceAge4/". The
Documentation for the GetFIleTime function leads me to believe that it should accept a File Handle for either a File or a Folder; however that does not appear to be the case in Factorio. Insted, a "DATETIME" structure with Null/0 value is returned. This is (correctly) being interpreted as a January 1, 1601 - the same as the Windows Time Epoch.
The actual bug may in fact be that Factorio will "Load a Folder", instead of only showing <GAME>.zip files.
Re: [2.0.25] Unzipped saves from year 1601
Posted: Fri Dec 13, 2024 10:43 pm
by Muche
I can't reproduce Factorio mistaking a folder with a file, or trying to use folder's timestamp.

- TimeStampsTest-FileExplorer.jpg (42.04 KiB) Viewed 516 times

- TimeStampsTest-Factorio.jpg (46.52 KiB) Viewed 516 times
I have several files & folders of the same name, all dates look as expected.
Two old dates shown (5-testsavefile-oldinfo, 3-testsavefile-oldfile) were set manually - 5-testsavefile-oldinfo/info.json, 3-testsavefile-oldfile.zip.
Could you check timestamps of your SpaceAge2/info.json and SpaceAge4/info.json?
Re: [2.0.25] Unzipped saves from year 1601
Posted: Sat Dec 14, 2024 12:53 am
by eugenekay
Muche wrote: Fri Dec 13, 2024 10:43 pm
I can't reproduce Factorio mistaking a folder with a file, or trying to use folder's timestamp.
TimeStampsTest-FileExplorer.jpg
TimeStampsTest-Factorio.jpg
I have several files & folders of the same name, all dates look as expected.
Two old dates shown (5-testsavefile-oldinfo, 3-testsavefile-oldfile) were set manually - 5-testsavefile-oldinfo/info.json, 3-testsavefile-oldfile.zip.
Could you check timestamps of your SpaceAge2/info.json and SpaceAge4/info.json?
Hello,
Thank you for showing your Test setup, including the details of folders & contents

. In a fresh test environment, I can confirm that the "Date" displayed corresponds with that of the "info.json" file's timestamp.
In my original Post, I had modified the SpaceAge4/ folder quite a bit: I opened all of the non-binary files in my Editor (ie, excluding level.dat#). I am not certain if I made a Modification to info.json - I am sure that I opened it (it is in my Editor's history), and that its contents are simply the text "null" (which seems odd for a JSON file....), but I cannot tell if a "Save" was made to disk since I had no extra Nullness to add. However, I then re-zipped the save, deleted the Directory, and have continued with the Game... so the original metadata is lost in any case. Or my Editor decided to stick with the "January 1, 1601" date because its Windows.
If it is the case that "info.json" is used to determine the Date when loading a Save from Folder, this is still (apparently?) different from the methodology used to load a Save from Zip. Since the ZIP does not contain a Last-Modified entry for this file it must be determined from somewhere else - assumed to be the <SaveName>.zip file itself ? Why is the "Date" being determined using two different methods?
Personally, I would just not support "Load From Folder" at all, similar to other games which use this file format (Paradox games, eg Stellaris). But, this is already "Not a Bug".
