Skip to content
New issue

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

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

Already on GitHub? # to your account

vim-gitgutter doesn't work with csh #365

Closed
riesebie opened this issue Aug 5, 2016 · 14 comments
Closed

vim-gitgutter doesn't work with csh #365

riesebie opened this issue Aug 5, 2016 · 14 comments

Comments

@riesebie
Copy link

riesebie commented Aug 5, 2016

Error detected while processing function gitgutter#utility#git_supports_command_line_config_override[1]..gitgutter#utility#git_version:
line 1:
E484: Can't open file /tmp/v0mXMKI/2

csh --version
tcsh 6.18.01 (Astron) 2012-02-14 (x86_64-amd-FreeBSD) options wide,nls,dl,al,kan,sm,rh,color,filec

Runing zsh works fine.

On commandline git --version tells:
git version 2.9.2

This is FreeBSD 10.3

@airblade
Copy link
Owner

airblade commented Aug 8, 2016

What happens when you do this under csh?

:echo system('git --version')

@riesebie
Copy link
Author

What happens when you do this under csh?

:echo system('git --version')

git version 2.9.2

Elimar

@hholst80
Copy link

I was just going to report the same problem. Good catch @riesebie I did not think of checking my shell!

@riesebie
Copy link
Author

if $SHELL =~ "/bin/csh"
set shell=/bin/zsh
endif

helped. C-Shell is supposed to be a NON-POSIX shell and therefor isn't supported?

@airblade
Copy link
Owner

The stacktrace from your error message points to this line, which calls system('git --version').

I don't understand why it works when you execute that by hand, on Vim's command line, but not when executed by vim-gitgutter.

These days Vim is supposed to support non-POSIX shells. Anyway, vim-gitgutter switches to /bin/sh before running any external commands using pipes and/or redirection.

What shell does /bin/sh resolve to on your system?

@riesebie
Copy link
Author

The stacktrace from your error message points to this line, which calls system('git --version').

I don't understand why it works when you execute that by hand, on Vim's command line, but not when executed by vim-gitgutter.

These days Vim is supposed to support non-POSIX shells. Anyway, vim-gitgutter switches to /bin/sh before running any external commands using pipes and/or redirection.

What shell does /bin/sh resolve to on your system?

It represents the "Bourne Shell"
http://www.freebsd.org/cgi/man.cgi?sh(1)

@serpent7776
Copy link

I'm also experiencing this problem. There must be something wrong with shell settings, because even simple :echo system('echo 1') fails with E484: Can't open file.
Last working version is at 1937f06. Next commit breaks (because tries to use /bin/bash, which doesn't exist), but working fine if I edit autoload/gitgutter/utility.vim to use /bin/tcsh instead of /bin/bash. Changing /bin/bash to /bin/sh does not fix the issue.
I think there is some issue when running /bin/sh on FreeBSD.

@airblade
Copy link
Owner

airblade commented Sep 5, 2016

There must be something wrong with shell settings, because even simple :echo system('echo 1') fails with E484: Can't open file.

Well if that doesn't work, this plugin doesn't have a chance ;)

A quick way to look at the shell settings is to do :GitGutterDebug.

@serpent7776
Copy link

There must be something wrong with shell settings, because even simple :echo system('echo 1') fails with E484: Can't open file.

I rechecked this and :echo system() doesn't work only after gitgutter fails with E484: Can't open file. If I open vim with empty buffer it works as expected. I think it is because gitgutter don't restore shell settings after that error and leave vim with shell set to /bin/sh.

:GitGutterDebug tells me this on last working version:
gitgutter-debug-ok.log
and for not working version after E484: Can't open file occurs:
gitgutter-debug-not-ok.log
and I get a bunch of E484: Can't open file errors

For both current and last working version when I open vim with empty buffer and do :set shell=/bin/sh I get E484: Can't open file for :echo system('echo 1'). This puzzles me.

@serpent7776
Copy link

I just found that vim-plug seem to had similar issue here.
The fix is to do set shellredir=>%s\ 2>&1, because >& redirection is bashism and is not recognized by POSIX shell (/bin/sh).
I can confirm that when I do :set shell=/bin/sh and set shellredir to above value I can successfully execute :echo system('echo 1').
One possible drawback is that this includes stderr as well as stdout - I don't know is this an isue for gitgutter.

airblade added a commit that referenced this issue Sep 6, 2016
@airblade
Copy link
Owner

airblade commented Sep 6, 2016

@serpent7776 I think you've nailed it.

@riesebie @hholst80 @serpent7776 Please could you try 43e7c1f and make sure it works for you?

@serpent7776
Copy link

Works fine for me.

@airblade
Copy link
Owner

Thanks for letting me know @serpent7776. I'm going to assume this solves the problem for everyone and close the issue.

Let me know if you still have problems.

@riesebie
Copy link
Author

Latest versions works fine. Thanks @serpent7776 @airblade for cooperation

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants