-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
update time crate to 0.3 #3319
update time crate to 0.3 #3319
Conversation
ffb2e2b
to
aef63de
Compare
cool stuff, bravo :) Answer:
I don't care about that RUSTSEC-2020-0071, afaik, nobody is using this crate in production and rust sec is less worrying that C's
Just like GNU :)
I would like to see that update to 0.3 everywhere (or switch to chrono) |
See also #3300 |
a36fbbf
to
4d95f89
Compare
a44f081
to
3fc5b37
Compare
@g-k sorry for the ping :) do you have an update on this? This is the main blocker to have it in Debian :) |
Oh getting it in Debian is exciting! I'm not sure how to fix the remaining errors and I don't think I'll have time to finish it in a reasonable amount of time. Happy to hand it off if someone else wants to pick it up. |
I think I fixed all the issues but one:
(note the +01 vs +02 for the TZ) while the following work:
Not sure what is going on? |
Something related to DST seems likely. The dates seem to match with when the timezone changes. If I ❯ touch -t 03260500 test1 # March 26 5:00
❯ touch -t 03280500 test2 # March 28 5:00, DST starts March 27
❯ stat -c %x test1
2022-03-26 05:00:00.000000000 +0100
❯ stat -c %x test2
2022-03-28 05:00:00.000000000 +0200 (I use Using uutils (from this PR):
Note also the difference in rounding. |
|
79ad60e
to
6c6e55f
Compare
The GNU failure is
|
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.
Wow, they made a lot of breaking changes in the time
crate! Really nice to see this completed :)
// // We have to check that ft is valid time. Due to daylight saving | ||
// // time switch, local time can jump from 1:59 AM to 3:00 AM, | ||
// // in which case any time between 2:00 AM and 2:59 AM is not valid. | ||
// // Convert back to local time and see if we got the same value back. | ||
// let ts = time::Timespec { | ||
// sec: ft.unix_seconds(), | ||
// nsec: 0, | ||
// }; | ||
// let tm2 = time::at(ts); | ||
// if tm.tm_hour != tm2.tm_hour { | ||
// return Err(USimpleError::new( | ||
// 1, | ||
// format!("invalid date format {}", s.quote()), | ||
// )); | ||
// } |
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.
Why is this commented out? Is it no longer necessary or is it a remaining thing to port?
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 missed that, @g-k do you remember ? :)
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.
it isn't breaking any test on our side or GNU's
So, I am in favor of remove this piece of code
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.
Ugh yeah. This is a remaining thing to port, but also an edge case and probably hard to run into in practice.
IIRC time 0.3 dropped TZ support and removed the Tm struct and tm_isdst
flag, so I wasn't sure how to proceed since it didn't look like there were good alternatives.
Dropping the code and waiting for support in icu4x seems like a reasonable path to me (icu would also potentially let coreutils handle localized strftime args).
Mentioned it a bit in this part of #3319 (comment) but I had the wrong struct and flag name:
How does this project want to handle datetimes and TZ data? This PR disables touch filetime printing daylight savings time tests. time 0.3 removes timezone support and the Timespec DST flag (upstream issue time-rs/time#351). Unicode icu4x might provide longer term stability and allow us to localize dates and times for strftime %b and %c currently we assume LC_ALL=C e.g. from unicode-org/icu4x#1317
6c4362a
to
9c998c7
Compare
Actually, I am wrong: I will have a look to the errors |
Bumps [time](https://github.com/time-rs/time) from 0.1.43 to 0.3.9. - [Release notes](https://github.com/time-rs/time/releases) - [Changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md) - [Commits](time-rs/time@v0.1.43...v0.3.9) --- updated-dependencies: - dependency-name: time dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
And no longer ignore RUSTSEC-2022-0013
a201b23
to
f5d1021
Compare
Finally! :) Not perfect. I am not happy with the long list of format_description in touch.rs I will land it to iterate from it reported: |
Finally! This is amazing! |
This is a draft PR to fix #2884 it still needs some clean up work, but I'd like to get feedback on this approach and the scope of the issue.
Changes:
time
crate to 0.3Caveats / Questions:
touch
filetime printing daylight savings time tests.time 0.3
removes timezone support and the Timespec DST flag (upstream issue Timezones a-la chrono-tz time-rs/time#351). Unicode icu4x might provide longer term stability and allow us to localize dates and times for strftime%b
and%c
currently we assumeLC_ALL=C
e.g. from Create an Ideal Components Bag / Skeleton for DateTimeFormat unicode-org/icu4x#1317time
0.1 indirectly viachrono
.chrono
to update to time 0.3 and bump time chronotope/chrono#639 (comment) suggests they aren't planning to. I can see spinning this off into a separate issue.time 0.3
usesunsound_local_offset
config. My read is that racing multithreaded reads of env vars are unlikely to be an issue for single threaded, short lived CLI utils, but I can do more in this PR to isolate and limit the number of fallible calls e.g. read offset once at load.Tests:
RUSTFLAGS="--cfg unsound_local_offset" cargo test --features=feat_require_unix_utmpx,feat_common_core
passes locally with version: