Closed Puffy1215 closed 1 month ago
i guess you saw it but the builds are failing
i guess you saw it but the builds are failing
Windows and macOS is still broken. I'll work on fixing those. I will also fix the still existing linting issues.
Attention: Patch coverage is 63.01370%
with 135 lines
in your changes missing coverage. Please review.
Project coverage is 58.08%. Comparing base (
a87683f
) to head (633aea3
). Report is 27 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
It looks like I have everything working now. The existing errors appear to be from other utilities.
failures:
test_mountpoint::test_invalid_arg
test_rev::test_invalid_arg
dunno if it is hard to do but could you please add tests with an invalid /var/log/wtmp to check that the error management is properly done ? thanks
dunno if it is hard to do but could you please add tests with an invalid /var/log/wtmp to check that the error management is properly done ? thanks
Added one test so far that matches the behavior with the linux org implementation. That seems like the only test I could get working so far. There were some discrepancies I noticed that I think are beyond my implementation, and involve the UtmpxIter
code.
For example, if you have a file of arbitrary bytes (Say a file of one long string of all 'a' characters) which can fit into Utmpx
struct, the linux org implementation is able to read it into the fields and display it. However, with our implementation, it does not load any of them into a struct, and so displays nothing.
a bunch of jobs are failing, could you please have a look?
Like:
error: length comparison to zero
--> src/uu/last/src/platform/unix.rs:190:16
|
190 | if ut_stack.len() == 0 {
| ^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `ut_stack.is_empty()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
= note: `-D clippy::len-zero` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::len_zero)]`
error: useless conversion to the same type: `i64`
--> src/uu/last/src/platform/unix.rs:275:62
|
275 | let time = time::OffsetDateTime::from_unix_timestamp(secs.into())
| ^^^^^^^^^^^ help: consider removing `.into()`: `secs`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `-D clippy::useless-conversion` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::useless_conversion)]`
error: useless conversion to the same type: `u64`
--> src/uu/last/src/platform/unix.rs:277:36
|
277 | + Duration::from_nanos(nsecs.into());
| ^^^^^^^^^^^^ help: consider removing `.into()`: `nsecs`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
error: useless conversion to the same type: `uucore::utmpx::time::OffsetDateTime`
--> src/uu/last/src/platform/unix.rs:284:13
|
284 | OffsetDateTime::from(time).replace_offset(offset) + Duration::from_secs(offset_secs);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `OffsetDateTime::from()`: `time`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
@Puffy1215 ping?
I implemented the last utility in https://github.com/uutils/util-linux/issues/18.
Limitations
Tests I added some tests too to go along with the PR. They are kind of simplistic though in that they only do a check to verify there was some output. The timestamp checks only do a simplistic regex check on the output.