Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

ysxninja
Copy link

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
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
Author

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

Link to issue
#31

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
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.

\ '|endif'
endfor
endif
endfunction
if $SUDO_COMMAND =~# '^sudoedit '
let file_name = expand('%:t:p')
if file_name =~# '.\{-}\(XX\)\@='
Copy link
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
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

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
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