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

Interface newtypes #879

Merged
merged 27 commits into from
Oct 22, 2024
Merged

Conversation

van-sprundel
Copy link
Contributor

@van-sprundel van-sprundel commented Oct 13, 2024

Implementation for #769.

Throughout the code, id.get() is called. We could implement Deref so we can *id into the libc type. deref coercion makes this nice to work with.

@squell squell linked an issue Oct 14, 2024 that may be closed by this pull request
src/exec/interface.rs Outdated Show resolved Hide resolved
src/common/context.rs Outdated Show resolved Hide resolved
src/exec/no_pty.rs Outdated Show resolved Hide resolved
src/su/context.rs Outdated Show resolved Hide resolved
@van-sprundel van-sprundel marked this pull request as ready for review October 15, 2024 19:08
src/sudo/mod.rs Outdated Show resolved Hide resolved
src/system/mod.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@rnijveld rnijveld left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to do this! Amazing work already, but I think we can be a little more strict with getting the inner value of the different newtypes. There really shouldn't be a need to access the inner value except for interoperating with functions from libc (and the serialization/deserialization for the timestamp files). So I think naming those .get() methods to something a little more scary sounding like .inner() or .unwrap() makes sense. I've also commented on a few places where I think we can replace getting the inner value with an alternative syntax that doesn't need to get the inner value.

(sorry for my late response in this thread by the way, I was away for a couple of weeks, I hope my feedback is still appreciated)

src/exec/no_pty.rs Outdated Show resolved Hide resolved
src/exec/use_pty/monitor.rs Outdated Show resolved Hide resolved
src/su/context.rs Outdated Show resolved Hide resolved
src/sudoers/mod.rs Outdated Show resolved Hide resolved
src/sudoers/test/mod.rs Outdated Show resolved Hide resolved
src/sudoers/test/mod.rs Outdated Show resolved Hide resolved
src/system/interface.rs Outdated Show resolved Hide resolved
src/system/mod.rs Outdated Show resolved Hide resolved
@van-sprundel
Copy link
Contributor Author

van-sprundel commented Oct 22, 2024

I hope my feedback is still appreciated

Always! I've learned some new things from both you and bjorn's feedback, so thanks for taking the time

@squell
Copy link
Member

squell commented Oct 22, 2024

There are a lot of merge commits and 'fix' commits in this PR that I'd prefer to see squashed, I'll fiddle with the repo.

@squell squell merged commit bac5bcf into trifectatechfoundation:main Oct 22, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add newtypes for UserId, GroupId and ProcessId
4 participants