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

Handling of negative tv_secs values #917

Open
sunfishcode opened this issue Nov 1, 2023 · 0 comments
Open

Handling of negative tv_secs values #917

sunfishcode opened this issue Nov 1, 2023 · 0 comments

Comments

@sunfishcode
Copy link
Member

Linux uses unsigned types for stat fields like st_mtime which are actually signed. Values with the most significant bit indicate negative time offsets from the epoch, which is to say, dates before 1970. Currently rustix just re-exports the kernel's stat struct, so it inherits this problem of using unsigned types for things that hold signed data.

rustix should change to using its own type for stat. That's also a chance to make st_mode be a Mode, st_uid be a Uid, and so on, and maybe even have things like st_mtime/st_mtime_nsec be a Timespec.

While here, macOS has a bug with negative timestamps, details here, and rustix should consider applying a similar fix.

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

No branches or pull requests

1 participant