[2.0.25] Unzipped saves from year 1601

Bugs that are actually features.
eugenekay
Filter Inserter
Filter Inserter
Posts: 692
Joined: Tue May 15, 2018 2:14 am
Contact:

[2.0.25] Unzipped saves from year 1601

Post by eugenekay »

Unzipping a Save file (to experiment with control.lua / freeplay.lua) results in time travel to the year 1601. :D

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.
Attachments
Screenshot 2024-12-13 110430.png
Screenshot 2024-12-13 110430.png (190.74 KiB) Viewed 655 times
Screenshot 2024-12-13 105620.png
Screenshot 2024-12-13 105620.png (1.2 MiB) Viewed 655 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4143
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.25] Unzipped saves from year 1601

Post 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?
eugenekay
Filter Inserter
Filter Inserter
Posts: 692
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: [2.0.25] Unzipped saves from year 1601

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

Re: [2.0.25] Unzipped saves from year 1601

Post 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.
If you want to get ahold of me I'm almost always on Discord.
eugenekay
Filter Inserter
Filter Inserter
Posts: 692
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: [2.0.25] Unzipped saves from year 1601

Post 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.
Muche
Smart Inserter
Smart Inserter
Posts: 1006
Joined: Fri Jun 02, 2017 6:20 pm
Contact:

Re: [2.0.25] Unzipped saves from year 1601

Post by Muche »

I can't reproduce Factorio mistaking a folder with a file, or trying to use folder's timestamp.
TimeStampsTest-FileExplorer.jpg
TimeStampsTest-FileExplorer.jpg (42.04 KiB) Viewed 514 times
TimeStampsTest-Factorio.jpg
TimeStampsTest-Factorio.jpg (46.52 KiB) Viewed 514 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?
eugenekay
Filter Inserter
Filter Inserter
Posts: 692
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: [2.0.25] Unzipped saves from year 1601

Post 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". :-)
Post Reply

Return to “Not a bug”