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

Implement program last #18

Open
sylvestre opened this issue Mar 2, 2024 · 10 comments
Open

Implement program last #18

sylvestre opened this issue Mar 2, 2024 · 10 comments
Labels
good first issue Good for newcomers

Comments

@sylvestre
Copy link
Contributor

       last - show a listing of last logged in users
@sylvestre sylvestre added the good first issue Good for newcomers label Mar 2, 2024
@kanielrkirby
Copy link

Hey there, @sylvestre. I'm looking to expand my knowledge with Rust, and was wanting to try taking this on.

I've done a bit of poking around in the OpenBSD version of last.c, as well as looking at pinky.rs (which also uses utmpx), and utmpx.rs. I was wondering a couple of things, just for clarification.

  • For starters, do you think this is the right direction for getting resources to get a good implementation down?
  • Would the move here be to add the crate for the coreutils implementation of utmpx.rs and use that to generate the list?
  • Is the util-linux repo meant to also be used for other operating systems (Windows, *BSD, Mac) like the coreutils repo?

@cakebaker
Copy link
Contributor

was wanting to try taking this on

Great :)

For starters, do you think this is the right direction for getting resources to get a good implementation down?

Sounds good to me.

Would the move here be to add the crate for the coreutils implementation of utmpx.rs and use that to generate the list?

Probably, though I don't know. The dependency itself is already defined (uucore), you simply have to enable the utmpx feature.

Is the util-linux repo meant to also be used for other operating systems (Windows, *BSD, Mac) like the coreutils repo?

Yes, it's a long-term goal and we currently run things on Windows and MacOS in the CI. But it's fine if it's Linux-only.

Hope that helps and maybe @sylvestre will chime in when he returns from vacation.

@kanielrkirby
Copy link

Awesome! Thanks for the info, and I'll see what I can get done on this.

@Puffy1215
Copy link
Contributor

Hello, I noticed this issue and was hoping to work on it as well. Some practice with Rust is always a good thing :).

If kirby is still working on the last that is fine, but I was thinking I could try working on the utmpdump command at the same time if that's not a problem. I did not see an issue written for that command yet.

@sylvestre
Copy link
Contributor Author

@Puffy1215 I haven't seen anything from @kanielrkirby . I think you can go ahead :)

@kanielrkirby
Copy link

Ah, I had gotten a bit busy, sorry about that! If you'd like @Puffy1215, I could share the implementation I have currently, if only just for some inspiration / somewhere to start.

@kanielrkirby
Copy link

I think I spent a while trying to get parity with GNU, and that's always a pain haha. I'll have to get a solid implementation down next time I work on this repo before going down that rabbit hole!

Anywho, it should be on the main branch, happy to hand it off to you if you still want, Puffy. Apologies for never following up, @sylvestre, I'm bad about that it seems haha. github.com/kanielrkirby/util-linux

@kanielrkirby
Copy link

I think the main point of interest at the time was that I needed to override the way utmpx does the DNS host resolution, as I believe the data might be structured differently on BSD systems. i.e., there's a host column, and an ipv6 column, and if the host just has a kernel, then it uses the ipv6 (or something like that, it's been a little bit since I had a chance to work on this). So that might be a good issue to make for the utmpx / uucore repo/crate, to get better parity with GNU. Though I'm not sure how it interacts with other tooling in util-linux or coreutils, so I can't be positive that's doable.

@kanielrkirby
Copy link

Hey there @Puffy1215. I'm happy to pick this one back up if you lost interest. Just let me know if you still wanted to work on this one. Happy hacking :)

@Puffy1215
Copy link
Contributor

@kanielrkirby I had a partially working implementation for last, so I will try to make a pull request for it this week. It was missing some functionality, but looking through the other utilities that seems to be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

4 participants