68
you are viewing a single comment's thread
view the rest of the comments
[-] trevor@lemmy.blahaj.zone 16 points 3 days ago

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.

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?

[-] ethancedwards8@programming.dev 8 points 3 days ago

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

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.

[-] trevor@lemmy.blahaj.zone 4 points 3 days ago* (last edited 3 days ago)

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 ¯\_(ツ)_/¯

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.

[-] trevor@lemmy.blahaj.zone 4 points 3 days ago

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.

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.

[-] dessalines@lemmy.ml 2 points 3 days ago

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

[-] thingsiplay@beehaw.org 2 points 3 days ago

I looked at it, its on the todo list. I also use sudoedit (or sudo -e). I can't find the todo list, but here is the issue for: https://github.com/trifectatechfoundation/sudo-rs/issues/762

this post was submitted on 13 Jun 2025
68 points (98.6% liked)

Rust

7063 readers
24 users here now

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

Wormhole

!performance@programming.dev

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