this post was submitted on 13 Jun 2025
71 points (97.3% liked)

Rust

7121 readers
1 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
top 17 comments
sorted by: hot top controversial new old
[–] [email protected] 35 points 2 weeks ago (1 children)

One thing to note is that sudo-rs is not aiming to be a 1:1 reimplementation.

Foreshadowing some tension...

[–] [email protected] 26 points 2 weeks ago (1 children)
[–] pebbles 8 points 2 weeks ago

Thats a good one

[–] [email protected] 18 points 2 weeks ago (2 children)

Rare Canonical W. The only thing I miss from the original sudo is sudoedit, but I'm pretty sure that's on the Rust implementation's TODO list.

[–] sugar_in_your_tea 10 points 2 weeks ago (2 children)

They've got a few months to get it done, and it shouldn't be that hard, no? Just exec EDITOR as a child process, no?

[–] [email protected] 10 points 2 weeks ago (1 children)

It also does input validation to ensure one doesn’t break the sudo file.

[–] sugar_in_your_tea 5 points 2 weeks ago

Sure. I guess it would depend on how complex that is, but surely the sudo command already does validations, so it would just need to have the editor write to a temporary file (which is a copy of the official one) and write once it's validated, right?

It sounds doable in a few months.

[–] [email protected] 6 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

I don't think it's that simple. The challenge is that you need to still behave as if it's invoked as the user so that the editor uses their configurations instead of simply execing it as root.

I could be wrong though ¯\_(ツ)_/¯

[–] sugar_in_your_tea 2 points 2 weeks ago (1 children)

Sudo uses the setuid bit or whatever, so it still has access to the user's environment variables and whatnot. So figuring out which editor to run shouldn't be an issue.

[–] [email protected] 6 points 2 weeks ago (1 children)

That's not what I mean. Yeah, getting the environment variables are simple enough, but if you simply exec something as the root user, whatever you exec will naturally be looking for configs in /root/.config and not your ~/.config dir, so any configurations to things like your text editor won't be read.

[–] sugar_in_your_tea 2 points 2 weeks ago

Ah, makes sense. It's easy enough to duplicate the outer ENV for the sub-process, but I don't know what that means for security and whatnot.

[–] [email protected] 3 points 2 weeks ago

Yep. They make some strange decisions sometimes but this isn't one of them.

[–] [email protected] 12 points 2 weeks ago

I’ve switched my Nix setup to this sudo implementation a while ago, and have noticed no downsides thus far. I’ll take the memory safety, with a fresh codebase

[–] [email protected] 12 points 2 weeks ago (1 children)

Time for people to be mad that sudo-rs isn't GPL even though the original sudo wasn't GPL either.

[–] [email protected] 4 points 2 weeks ago (1 children)

It isn't? What is it's license then

[–] [email protected] 4 points 2 weeks ago

Wikipedia says ISC

[–] [email protected] 7 points 2 weeks ago

Surely this won't upset people.