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

reinstall: avoid duplicate users in loginctl_users #1094

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omertuc
Copy link
Contributor

@omertuc omertuc commented Feb 7, 2025

See #1093

@omertuc
Copy link
Contributor Author

omertuc commented Feb 7, 2025

Draft because still testing

use std::fmt::Display;
use std::fmt::Formatter;
use std::process::Command;
use uzers::os::unix::UserExt;

fn loginctl_users() -> Result<Vec<String>> {
fn loginctl_users() -> Result<HashSet<String>> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to use BTreeSet so the order isn't random.


As far as testing, one pattern we use elsewhere with code like this is to have a unit test with some example output as a fixture. See the blockdev code for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants