On Sun, 30 Jan 2011, Britton Kerin wrote:

On Fri, Jan 28, 2011 at 4:18 PM, Benjamin R. Haskell wrote:
On Fri, 28 Jan 2011, Britton Kerin wrote:

There is some strange bug that causes line numbers in errors coming from perl to come out wrong in some circumstances.

[...]

The fact that it works properly under "real" perl might not have much bearing on diagnosing this.  Often libperl.so is a separately-compiled library that Vim would've been linked against, so running commandline perl wouldn't even necessarily be the same version of perl that Vim could be picking up.

Good point.

I rebuilt against perl 5.12.3 and the problem with the line numbers went away. Could you do me a favor and let me know which perl version your setup ends up call? Something like:

    strace ./vim -i NONE -u NONE -N -g --nofork 2>&1 | grep 'perl'

And then :e line_number_test_fail.vim and :so % should show a version number. If you are also using a more recent perl than 5.10 I'll blame this one on perl.

My tests were also done under 5.12. 5.12.1 is the only perl installed on my system ATM. Both libperl.so.5.12 and /usr/bin/perl were compiled at the same time. `ldd =vim` confirms it's the one in use.

Now that you cast suspicion on the version, though: I tried testing under an Ubuntu 9.10 VM, with Vim 7.2 (w/ patches 1-245) and libperl 5.10, and was able to reproduce the problem.

On the same VM, using the latest version of Vim from hg (7.3 w/ patches 1-107), the problem is still reproducible, so it does appear to be something triggered only with the use of pre-5.12 libperls.


After installing your plugin (3406, the line-directive adding one), I notice a few things:

1. It seems to strip the last line of the file regardless of its contents.

2. As part of that, it removes the closing heredoc marker.

perl <<END_PERL
## some perl stuff
END_PERL

becomes:

perl <<END_PERL
# line 3 filename
## some perl stuff

3. It seems to add a second line-directive even if one already exists, which kind of negates its purpose (end up with two "# line 3" directives, the second of which occurs before line 4, so off-by-one).

How tiresome that I can't reproduce either of these problems with either version of perl. If you could send me the output of these commands:

  vim --version
  ldd (your vim binary)
  strace vim -i NONE -u NONE -N -g --nofork -c ':edit ~/line_number_test_fail.vim' -c 
':silent so %' -c ':quit' 2>&1 | grep perl

Why the '-g' and '--nofork'? I virtually never use gvim, so I don't use GUI mode (-g).

In any case, I can reproduce it under both Gentoo (7.3 no patches, Huge version without GUI), where libperl is 5.12. And under the Ubuntu VM I described above. libperl 5.10, Vim versions 7.2 (Huge with no GUI w/ patches 1-245), and 7.3 (Huge with GTK2 GUI w/ patches 1-107).

Under the VM, I even minimized my .vimrc to:
filetype plugin indent on
syntax on

Yours is the only plugin I installed, via standard `vim update_perl_line_directives.vba` then ':so %'.

File contents, prior to plugin installation (the comment on line 2 is literal, there's no non-comment Perl code):

==> ~/test.perl.vim <==
perl <<END_PERL
## some perl stuff
END_PERL
=======================

After opening, then running ':w':

==> ~/test.perl.vim <==
perl <<END_PERL
# line 3 "~/test.perl.vim"
## some perl stuff
=======================

The last-line deletion only seems to occur when there was no line directive initially.

--
Best,
Ben

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui