Skip to content

fix filetype detection in sudo>=1.8.13 #SudoEditInit#79

Closed
ysxninja wants to merge 1 commit intotpope:masterfrom
ysxninja:fix/detection
Closed

fix filetype detection in sudo>=1.8.13 #SudoEditInit#79
ysxninja wants to merge 1 commit intotpope:masterfrom
ysxninja:fix/detection

Conversation

@ysxninja
Copy link
Copy Markdown

Fix filetype detection in vim-eunuch.
Existing workaround requires creation of a shell function:
sudoedit() { SUDO_COMMAND="sudoedit $1" command sudoedit "$1" }

@tpope
Copy link
Copy Markdown
Owner

tpope commented Oct 21, 2021

Would you happen to have a link to a changelog/CVE/whatever that explains what changed?

@ysxninja
Copy link
Copy Markdown
Author

Link to bugfix
https://bugzilla.sudo.ws/show_bug.cgi?id=688

Link to issue
#31

Comment thread plugin/eunuch.vim
let files = split($SUDO_COMMAND, ' ')[1:-1]
if len(files) ==# argc()
for i in range(argc())
let ppid = system('ps -o ppid:1= -p ' . getpid())
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This appears not to work on BSD ps. Tested on macOS.

Comment thread plugin/eunuch.vim
endfunction
if $SUDO_COMMAND =~# '^sudoedit '
let file_name = expand('%:t:p')
if file_name =~# '.\{-}\(XX\)\@='
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This isn't portable either. XX appears to be Linux specific.

@tpope
Copy link
Copy Markdown
Owner

tpope commented Apr 9, 2022

This feature no longer works on any host I have access to, so I have removed it for now.

In addition to the portability issues I have called out, I have concerns about calling system() twice on every Vim startup. Users often misconfigure Vim so that shelling out is broken or slow, and even properly configured, "fast" isn't a guarantee. There's also issues like spaces in filenames breaking the parsing (also a problem with the old version).

I think it may be time to walk away. I am thus closing this PR, but I am not ruling out pursuing a more robust solution.

@tpope tpope closed this Apr 9, 2022
@SuperSandro2000
Copy link
Copy Markdown

Well, at least the shell alias worked very well for me and didn't hurt in the pile of all the other aliases and functions. Removing the feature entirely is a bit sad but might as well copy the one function into my vimrc and drop the rest of the plugin.

@tpope
Copy link
Copy Markdown
Owner

tpope commented Apr 12, 2022

If that was your attempt to get me to bring it back, then I regret to inform you it has backfired.

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.

3 participants