Closed lofic closed 3 years ago
I tried with :
let g:syntastic_puppet_puppet_exe='LANG=C LC_ALL=C puppet'
let g:syntastic_puppet_puppetlint_exe = "LANG=C LC_ALL=C puppet-lint"
in my ~/.vimrc
But it's not working.
Please post the output of :echo syntastic#util#system('puppet --version')
.
:echo syntastic#util#system('puppet --version')
gives :
2021-02-21 15:42:02.536709 WARN puppetlabs.facter - locale environment variables were bad; continuing with LANG=C LC_ALL=C
6.21.0
syntastic#util#system()
differs from system()
in that it sets LC_ALL=
and LC_MESSAGES=C
, and it uses the shell named by g:syntastic_shell
(if set). The point of this is to get error messages in English rather than localized, so that syntastic can parse them. To further complicate things, version testing doesn't use syntastic_puppet_puppet_exe
, it only cares about syntastic_puppet_puppet_exec
. There is no way to override any of these, so basically you need to configure things so that they survive syntastic#util#system()
without messing with the environment inside Vim. One way to do that might be to write a shell wrapper that sets the environment and runs puppet
, then set syntastic_puppet_puppet_exec
to point to it. Perhaps something like this (not tested):
#!/bin/sh
LC_ALL=C
export LC_ALL
LANG=C
export LANG
exec /path/to/puppet "$@"
According to your logs puppetlint
runs without errors, it's only puppet
that bails out.
Hello,
I confirm it works with your wrapper script.
But I can't figure out why it works in other contexts (i.e. on a CentOS) without the workaround.
This would be a clue for a nice solution.
Louis
Do you know a way to output messages from SyntasticCheck to the shell or a file, for more tests :
vim -c ':SyntasticCheck' -c ':q' test.pp
?
This would be a clue for a nice solution.
This is Vim we're talking about, a wrapper is about as nice as it gets.
Do you know a way to output messages from SyntasticCheck to the shell or a file, for more tests
For redirecting output to a file see :h :redir
. If you want something that runs Vim from command line, runs a script, then exits, I used to know how to do that at some point, but I discarded that knowledge at some point, in the interest of my sanity. :smile:
Anyway, you probably don't need to go there, your problem seems to be puppet
not liking "hybrid" locales, unrelated to either Vim or syntastic. You can probably reproduce it by running something like this in a terminal:
LC_ALL= LANG=C puppet --version
Hello,comparing the output of locale
in a shell and in vim I've been able to reproduce in a shell :
$ LC_ALL= LANG=en_US puppet --version
2021-02-22 10:09:32.287296 WARN puppetlabs.facter - locale environment variables were bad; continuing with LANG=C LC_ALL=C
6.21.0
Then I found this line in my ~/.vimrc from something like 15 years ago :
let $LANG='en_US'
This was the culprit.
Setting :
let $LANG='en_US.UTF-8'
Fixes it.
Thank you for your help and patience !
Louis
Hello,
I get :
It seems to be during the check of the puppet version
It can't parse this for the version :
I don't know how to suppress the warning or set the version forcibly.
It happens on Debian 10 where puppet is installed with the third part puppetlabs repos. I got that on a laptop with Debian, a VM with Debian, and Debian in a WSL.
In a shell it is fine :
In vim,
:echo system('puppet --version')
gives :6.21.0
:echo $SHELL
gives :/bin/bash
:SyntasticInfo
gives :Setting g:syntastic_debug to 3,
Regards.
Louis