-
Notifications
You must be signed in to change notification settings - Fork 14.1k
std: sys: fs: uefi: Make time in FileAttr optional #149538
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
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use |
|
@joboet Can you take a look at this since it kinda follows https://github.com/rust-lang/rust/pull/13891833 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error messages should start in lowercase, apart from that this looks fine.
e862f1a to
bd7f68d
Compare
Fixed |
library/std/src/sys/fs/uefi.rs
Outdated
| pub(crate) fn uefi_to_systemtime(mut time: r_efi::efi::Time) -> SystemTime { | ||
| pub(crate) fn uefi_to_systemtime(mut time: r_efi::efi::Time) -> Option<SystemTime> { | ||
| time.timezone = if time.timezone == r_efi::efi::UNSPECIFIED_TIMEZONE { | ||
| time::system_time_internal::now().unwrap().timezone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a panic message here (and in systemtime_to_uefi) as well, like in SystemTime::now. Or maybe make system_time_internal::now() panic directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all users of system_time_internal::now() were calling unwrap on it, I have made the function itself panic.
At least on OVMF, some files copied over from linux file system seem to have invalid time (year = 1980 and everything else 0). Since Rust allows time to be optional and we can return error, that seems to be the way to go for now. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
bd7f68d to
1331c35
Compare
|
Great, r=me once CI passes. |
|
✌️ @Ayush1325, you can now approve this pull request! If @joboet told you to " |
Rollup of 5 pull requests Successful merges: - #146436 (Slice iter cleanup) - #148250 (array_chunks: slightly improve docs) - #148678 (Merge E0412 into E0425) - #149520 (also introduce Peekable::next_if_map_mut next to next_if_map) - #149538 (std: sys: fs: uefi: Make time in FileAttr optional) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #149538 - Ayush1325:uefi-fs-time-fix, r=joboet std: sys: fs: uefi: Make time in FileAttr optional At least on OVMF, some files copied over from linux file system seem to have invalid time (year = 1980 and everything else 0). Since Rust allows time to be optional, and we can return error, that seems to be the way to go for now. `@rustbot` label +O-UEFI
At least on OVMF, some files copied over from linux file system seem to have invalid time (year = 1980 and everything else 0). Since Rust allows time to be optional, and we can return error, that seems to be the way to go for now.
@rustbot label +O-UEFI