Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File.creationDate showing wrong date on macOS Ventura #2657

Open
rat-moonshine opened this issue Sep 1, 2023 · 6 comments
Open

File.creationDate showing wrong date on macOS Ventura #2657

rat-moonshine opened this issue Sep 1, 2023 · 6 comments

Comments

@rat-moonshine
Copy link

rat-moonshine commented Sep 1, 2023

Describe the bug

We noticed that file's creationDate wrongly shows as current-date when the actual creation date is much older.

Screenshots

Please, consider the following screenshots:

Finder - showing creation date 03/20/2023 (mm/dd/yyyy):
image

When loaded with openfl.filesystem.File - it shows creationDate is today, 09/01/2023 (mm/dd/yyyy):
image

OpenFL Targets

OpenFL version: develop branch
Build target: macOS

Additional context

Haxe: 4.2.5

@joshtynjala
Copy link
Member

It appears that Haxe's sys.FileSystem.stat() is returning the wrong value for FileStat.ctime on macOS.

Comparing it to what Finder reports, Haxe's creation time is the same as the "Last opened" time.

@joshtynjala
Copy link
Member

joshtynjala commented Sep 11, 2023

I've determined that the same behavior applies to Linux. Apparently, the POSIX standard did not historically require file systems to track a file's creation time at all, and the stat syscall used to get information about a file does not provide that information. It provides a few other timestamps, but those are different. At best, it provides a "status change time" which was historically recommended as the next best thing to creation time, but it appears that it is often not the same as the creation time.

macOS provides a stat64 syscall that includes more information, including the creation time. (EDIT: nope, deprecated) macOS extends the stat struct to add a st_birthtime field. I might be able to patch hxcpp to use this instead.

Newer Linux file systems store the creation time, but I had difficulty determining if there's an appropriate new syscall in Linux to use to get this information.

@joshtynjala
Copy link
Member

I made a pull request for hxcpp:

HaxeFoundation/hxcpp#1063

It's possible it won't be merged. If that's the case, we may need to expose a C++ function from Lime instead.

Neko and HashLink seem to use the same inaccurate value from the stat syscall. I tried building both runtimes on macOS, but the builds failed on my machine (I've successfully built HashLink on this machine in the past, but there seems to be an issue with the latest mbedtls library from Homebrew, and I can't see how to downgrade it to whatever the older version was).

@joshtynjala
Copy link
Member

And I created an issue for HashLink: HaxeFoundation/hashlink#619

@rat-moonshine
Copy link
Author

Was there any update on this @joshtynjala , is it yet available to any develop branch (?)

@joshtynjala
Copy link
Member

@rat-moonshine Nothing has been merged into our dependencies, so the behavior remains the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants