std: sys: fs: uefi: Make time in FileAttr optional#149538
std: sys: fs: uefi: Make time in FileAttr optional#149538bors merged 1 commit intorust-lang:mainfrom
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 |
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.
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.
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