-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
test_system.vim not passing with X11 forwarding and PuTTY #1812
Comments
Xiretza wrote:
Note: this whole scenario requires vim to be configured with `--with-x=yes`.
When using X11Forwarding, authentication happens using the `~/.Xauthority` file. In [setup.vim][], `$HOME` gets set to a non-existent path, thus breaking authentication. This, in turn, produces an error message when executing `vim` with some SSH clients (notably PuTTY and its derivative MobaXterm) along the lines of `MobaXterm X11 proxy: Unsupported authorisation protocol` on stderr.
This error message gets prepended to the desired `$?` in [test_system.vim#L56][], so `a[0]` contains 'M', not '0'. This leads to the actual error message that gets produced when running `make test`:
```
>From test_system.vim:
Found errors in Test_system_exmode():
function RunTheTest[24]..Test_system_exmode line 7: Expected '0' but got 'M'
```
Since this isn't an error in how vim was compiled, but rather a result `$HOME` being unset, it shouldn't break testing.
It can be temporarily fixed by changing the value in setup.vim to something like `/tmp/vimhome`, creating that directory, and copying the `~/.Xauthority` file in there. A better solution would probably be to either set `$HOME` temporarily, or to have the test simply ignore stderr, for example by changing [test_system.vim#L52][]:
```vim
let cmd = ' -es -u NONE -c "source Xscript" +q 2>/dev/null; echo $?'
```
I've tracked the message down to [this line][puttyline] in the PuTTY sources, after which it seems to be passed back to the remote host.
For completeness, here's the steps to reproduce the test failure:
1. Connect to a machine using PuTTY/MobaXterm with X11 forwarding enabled on both sides
2. Run `make test` on a vim instance that's compiled with `+X11`
3. `Test_system_exmode()` fails
[test_system.vim#L52]: https://github.com/vim/vim/blob/da5116da4586fc714434411d2cccb066caa3723e/src/testdir/test_system.vim#L52
[test_system.vim#L56]: https://github.com/vim/vim/blob/da5116da4586fc714434411d2cccb066caa3723e/src/testdir/test_system.vim#L56
[setup.vim]: https://github.com/vim/vim/blob/da5116da4586fc714434411d2cccb066caa3723e/src/testdir/setup.vim#L12
[puttyline]: https://github.com/x54zhang/putty/blob/a3274ab7798c83137c86612affde6d28b87a4590/x11fwd.c#L390
First of all: it's possible to reset $DISPLAY to avoid Vim connecting to
the X server.
That extra error message gets in the way of the actual test output,
but it is otherwise harmless? We could change "echo $?" into something
like "echo "result = $?"", and then search the output for "result = {nr}".
Would that work?
…--
From "know your smileys":
<|-) Chinese
<|-( Chinese and doesn't like these kind of jokes
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
That would of course work. An even better solution might be to set |
> We could change "echo $?" into something like "echo "result = $?"",
> and then search the output for "result = {nr}".
That would of course work. An even better solution might be to set
`$XAUTHORITY` though, according to [man
xauth](https://linux.die.net/man/1/xauth) it can be used to point to
the `.Xauthority` file directly. This would avoid the error
altogether.
OK then, can you try this in testdir/setup.vim:
" Only when the +eval feature is present.
if 1
" Make sure the .Xauthority file can be found after changing $HOME.
if $XAUTHORITY == ''
let $XAUTHORITY = $HOME . '/.Xauthority'
endif
" Make sure $HOME does not get read or written.
let $HOME = '/does/not/exist'
endif
…--
hundred-and-one symptoms of being an internet addict:
98. The Alta Vista administrators ask you what sites are missing
in their index files.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
Sorry for the wait. That solution works great, thanks! |
dpelle
pushed a commit
to dpelle/vim
that referenced
this issue
Jul 31, 2017
Problem: System test failing when using X11 forwarding. Solution: Set $XAUTHORITY before changing $HOME. (closes vim#1812) Also use a better check for the exit value.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: this whole scenario requires vim to be configured with
--with-x=yes
.When using X11Forwarding, authentication happens using the
~/.Xauthority
file. In setup.vim,$HOME
gets set to a non-existent path, thus breaking authentication. This, in turn, produces an error message when executingvim
with some SSH clients (notably PuTTY and its derivative MobaXterm) along the lines ofMobaXterm X11 proxy: Unsupported authorisation protocol
on stderr.This error message gets prepended to the desired
$?
in test_system.vim#L56, soa[0]
contains 'M', not '0'. This leads to the actual error message that gets produced when runningmake test
:Since this isn't an error in how vim was compiled, but rather a result
$HOME
being unset, it shouldn't break testing.It can be temporarily fixed by changing the value in setup.vim to something like
/tmp/vimhome
, creating that directory, and copying the~/.Xauthority
file in there. A better solution would probably be to either set$HOME
temporarily, or to have the test simply ignore stderr, for example by changing test_system.vim#L52:I've tracked the message down to this line in the PuTTY sources, after which it seems to be passed back to the remote host.
For completeness, here's the steps to reproduce the test failure:
make test
on a vim instance that's compiled with+X11
Test_system_exmode()
failsThe text was updated successfully, but these errors were encountered: