vim-suda icon indicating copy to clipboard operation
vim-suda copied to clipboard

doas support?

Open ghost opened this issue 3 years ago β€’ 14 comments

Would you please support doas if you like?

ghost avatar Mar 21 '21 05:03 ghost

I agree with this.

suda] sudo: invalid option -- 'p'
[suda] usage: doas [-Lns] [-C config] [-u user] command [args]

This is what I receive after inputting my password when running :SudaWrite, I don't think it'd take much to add it in.

subterfugue avatar Apr 10 '21 23:04 subterfugue

please make this hapeend

AnasR7 avatar Jun 06 '21 00:06 AnasR7

Maybe make it use su instead, as that's installed on most if not all systems as far as I know. For example, makepkg uses su if sudo is not found...

not-a-robot06 avatar Aug 30 '21 12:08 not-a-robot06

Oops. I'm sorry I didn't notice this request. Well, I have no idea what "doas" and I have no idea what to do to support it.

lambdalisue avatar Aug 31 '21 02:08 lambdalisue

doas is alternative to sudo https://wiki.archlinux.org/title/Doas sudo has the -p option, but doas does not, so symbolic links will not work γ‚‚γ—γ‚ˆγ‘γ‚Œγ°η§γ«ε―Ύγ—γ¦ζ—₯本θͺžγ‚’話してください

ghost avatar Aug 31 '21 09:08 ghost

I've already cloned this project and tried to work on it, but I've hit a "roadblock,", doas doesn't have the flag that sudo does to pass the password to, so you're probably going to use expect or socat or something like that. It's likely not going to be that hard, but maybe it'd be more efficient if it uses something that's essentially really light and exists on all systems that isn't exactly replacable, like maybe the su util or something more tightly-knit, I'm unsure. Do as you wish, and thank you for listening!

subterfugue avatar Aug 31 '21 23:08 subterfugue

Probably, I'm not going to support doas or su in suda.vim (by myself) while suda.vim has technical limitation (#34). Instead, maybe I'll create a new fresh plugin for handle #34 and then I'll consider to support doas and/or su.

γ‚‚γ—γ‚ˆγ‘γ‚Œγ°η§γ«ε―Ύγ—γ¦ζ—₯本θͺžγ‚’話してください

I'm sorry but it seems some people interested in this topic so I prefer to discuss it with English.

lambdalisue avatar Sep 01 '21 00:09 lambdalisue

This issue is fixed by #58

aarondill avatar Jun 27 '23 05:06 aarondill

@aarondill it's not, sudo-specific -p and -S flags are still used by the plugin

acid-bong avatar Jul 18 '23 19:07 acid-bong

@lambdalisue Line 18 of autoload/suda.vim needs to be changed to fully support doas (when a password is needed)

aarondill avatar Jul 18 '23 19:07 aarondill

@acid-bong I've looked at the source for doas, and it seems there's no way to pass a password to stdin, instead of requiring a terminal. Changing line 18 (see above) would allow it to work with any programs which read from stdin, but if it attempts to open a tty (like doas), we can only support the no password version.

I'm not certain of any tools for this purpose that do except through stdin, but the above mentioned change would allow them to work by default (after setting the executable variable)

aarondill avatar Jul 18 '23 19:07 aarondill

@aarondill a possible solution could be found somewhere in Emacs' tramp.el (for current stable branch, emacs-28), doas is one of the preconfigured privilege elevation tools in it. I know it does work flawlessly* (except when your default shell is zsh, but that's a different issue), but i'm yet to find out how it passes the password, because it doesn't use -S for sudo

acid-bong avatar Jul 18 '23 21:07 acid-bong

I still don't use doas so it's a bit hard for me to support it while I've no idea what I need to do so PRs are very welcome to support it.

lambdalisue avatar Jul 19 '23 03:07 lambdalisue

@aarondill a possible solution could be found somewhere in Emacs' tramp.el (for current stable branch, emacs-28), doas is one of the preconfigured privilege elevation tools in it. I know it does work flawlessly* (except when your default shell is zsh, but that's a different issue), but i'm yet to find out how it passes the password, because it doesn't use -S for sudo

Sadly, I can't for the life of me read lisp, especially when it's that abstracted. If you can figure it out, please let me know. My guess would be that emacs allows commands to open a tty when executing (like vim did), which nvim doesn't (I'm likely misunderstanding the root issue, but still), which is the original reason this plugin was necessary.

aarondill avatar Jul 19 '23 06:07 aarondill

With the merging of #60, you can now use doas only with nopass configured!

aarondill avatar Mar 12 '24 07:03 aarondill