godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.86k stars 19.45k forks source link

Same file returns different modified time in different Godot builds #92911

Open KoBeWi opened 1 month ago

KoBeWi commented 1 month ago

Tested versions

v4.3.beta1.official [a4f2ea91a] v4.3.beta.custom_build [a4f2ea91a]

System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 31.0.15.4633) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

Issue description

I noticed that whenever I open my project in a custom build, the scene groups are being re-scanned for no reason. Then it happens again when I use official build. Turns out that's because the 2 builds for some reason return different modified time for a file, which causes filesystem timestamp mismatch.

I made a simple editor script to illustrate the issue. I run it in 2 Godot instances build from the same commit, but one is official and one isn't:

https://github.com/godotengine/godot/assets/2223172/b2c4c3ba-588c-4e58-8736-0b294cf86058

I tested it with 2 files. One was a scene that belongs to a project, the other one was a random file I had in my downloads folder. The issue did not occur in case of the other file.

Steps to reproduce

  1. Print a modified time of a scene file that belongs to a different project
  2. Compare results from official and custom builds

Minimal reproduction project (MRP)

@tool
extends EditorScript

func _run() -> void:
    print(FileAccess.get_modified_time("path/goes/here.tscn"))
AThousandShips commented 1 month ago

And the modified time of the actual file in the OS is unchanged between the two checks?

KoBeWi commented 1 month ago

Yes, the file was last modified 3 months ago.

bruvzg commented 1 month ago

v4.3.beta.custom_build

MinGW or MSVC? Might be some difference in _wstat implementation.

KoBeWi commented 1 month ago

MSVC

AThousandShips commented 1 month ago

What's the results between official builds, custom build, and https://github.com/godotengine/godot/pull/74830, if it's _wstat related that might fix this as well

KoBeWi commented 1 month ago

https://github.com/godotengine/godot/pull/74830 does not seem to change anything. However the issue might be DST-related, as the file was last modified on 25 of March.

EDIT: I mean the file returns the same value in custom build with #74830, not sure about official build obviously.

AThousandShips commented 1 month ago

Which case does it match? The custom build or the official?

KoBeWi commented 1 month ago

Nervermind, I checked again and the time matches official build.

AThousandShips commented 1 month ago

That would make sense, was confused over the first result there, then that means that the MinGW _wstat handles DST correctly unlike MSVC

Since it doesn't just fix DST directly but fixed an inconsistency between MinGW and MSVC I've marked it for 4.3, would be good to get some new reviews on it