Skip to content

Rework logic in _sudo() and add support for sudo-rs#584

Merged
jaromil merged 3 commits into
dyne:masterfrom
Narrat:optim/sudo
Sep 17, 2025
Merged

Rework logic in _sudo() and add support for sudo-rs#584
jaromil merged 3 commits into
dyne:masterfrom
Narrat:optim/sudo

Conversation

@Narrat

@Narrat Narrat commented Sep 4, 2025

Copy link
Copy Markdown
Collaborator

The sudo wrapper _sudo has different behaviour depending if --sudo is used or not. It is more chatty with -D, --sudo sudo doesn't work and code duplications which could theoretically be avoided.
Therefore an attempt to make the function more general and instead of the two branches just provide one. The logic itself is inspired by the structure from the _pinentry wrapper.

And add support for sudo-rs

Not sure about adding the verbosity in general... It is rather chatty, but also a reminder for all those places were privilege escalation is needed :D

mix of tabs and whitespaces
If --sudo was supplied it would behave differently than without.
More verbose, different output, but in general the same behaviour as
without.
Additionally "--sudo sudo" wasn't working.

Now this is organized in one branch instead of two. Has the benefit that
instead of a direct failure when the argument of "--sudo" isn't found,
it will then fallback to sudo and doas. Both tools were checked upon if
--sudo wasn't used and counted as defaults.

Additionally adjust the man page in that regard.
@jaromil

jaromil commented Sep 17, 2025

Copy link
Copy Markdown
Member

Excellent! much more readable now too.

@jaromil jaromil merged commit 63f55f2 into dyne:master Sep 17, 2025
2 checks passed
@Narrat Narrat deleted the optim/sudo branch September 21, 2025 19:00
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.

2 participants