Error when deleting or yanking while not in insert mode. BadAccess (attempt to access private resource denied)

15 views
Skip to first unread message

Andreas Plesner

unread,
Apr 21, 2020, 5:35:23 AM4/21/20
to vim_dev
Hi,

My school provide a server from which we can run code. I pulled the newest version of git from GitHub since their version was outdated and I wanted one with python3 support so I could use YCM.

After during this I have had issues where I got the following error:

BadAccess (attempt to access private resource denied)
Vim: Got X error
Vim: Finished.

The error is raised when I try to delete characters or lines while not being in insert mode or I try to yank a line. I.e. the have been raised after i pressed "x", "dd", "yy" or "de" in normal mode.

I have not been able to determine why the error is raised and google have not helped. None of the tickets/forums, I found on google, are related to vim raising this error. Furthermore, the people behind the server did not have an idea for what caused this.

I have tried deleting and reinstalling vim. However, I now get the following error when start vim
$ ./src/vim
Vim: Caught deadly signal SEGV
Vim: Finished.
Segmentation fault

I am able to run ./src/vim --version and the output can be seen in here: https://pastebin.com/bnUi6uKF
Output when running vim --version, i.e. running he default vim provided on the server, can be sen here: https://pastebin.com/wbs6YAU5

When I downloaded the newest version again I did the following.
$ cd vim
$ make distclean
$ ./configure --enable-cscope --enable-multibyte --enable-rubyinterp --enable-pythoninterp --enable-python3interp

If more information is needed then please let me know.

Christian Brabandt

unread,
Apr 21, 2020, 5:45:40 AM4/21/20
to vim_dev
First of all, I apologize for not noticing, that your message was in the
moderation queue. But I did not receive a notification and just now
noticed this message.

On Fr, 17 Apr 2020, 'Andreas Plesner' via vim_dev wrote:

> Hi,
>
> My school provide a server from which we can run code. I pulled the newest
> version of git from GitHub since their version was outdated and I wanted
> one with python3 support so I could use YCM.
>
> After during this I have had issues where I got the following error:
>
> BadAccess (attempt to access private resource denied)
> Vim: Got X error
> Vim: Finished.

So there was a problem accessing something from the X Server. There have
been several reports in the past about something like this. The obvious
workaround is to not make vim connect to the X-Server (e.g. start with
-v parameter), however you will lose the clipboard functionality.

Another workaround might be to open os_unix.c search for x_error_handler
and do what the comment says:

/*
* X Error handler, otherwise X just exits! (very rude) -- webb
*/
static int
x_error_handler(Display *dpy, XErrorEvent *error_event)
{
XGetErrorText(dpy, error_event->error_code, (char *)IObuff, IOSIZE);
STRCAT(IObuff, _("\nVim: Got X error\n"));

// We cannot print a message and continue, because no X calls are allowed
// here (causes my system to hang). Silently continuing might be an
// alternative...
preserve_exit(); // preserve files and exit

return 0; // NOTREACHED
}

e.g. comment out the preserver_exit() call.

> The error is raised when I try to delete characters or lines while not
> being in insert mode or I try to yank a line. I.e. the have been raised
> after i pressed "x", "dd", "yy" or "de" in normal mode.

Do you have set `:set clipboard=unnamed`?

>
> I have not been able to determine why the error is raised and google have
> not helped. None of the tickets/forums, I found on google, are related to
> vim raising this error. Furthermore, the people behind the server did not
> have an idea for what caused this.
>
> I have tried deleting and reinstalling vim. However, I now get the
> following error when start vim
> $ ./src/vim
> Vim: Caught deadly signal SEGV
> Vim: Finished.
> Segmentation fault
>
> I am able to run ./src/vim --version and the output can be seen in here:
> https://pastebin.com/bnUi6uKF
> Output when running vim --version, i.e. running he default vim provided on
> the server, can be sen here: https://pastebin.com/wbs6YAU5
>
> When I downloaded the newest version again I did the following.
> $ git clone https://github.com/vim/vim.git
> $ cd vim
> $ make distclean
> $ ./configure --enable-cscope --enable-multibyte --enable-rubyinterp
> --enable-pythoninterp --enable-python3interp
>
> If more information is needed then please let me know.

Try to enable debugging (e.g. compile using the -g switch and then run
it under gdb, e.g. gdb --args ./vim --clean
when it crashes, you should be thrown into the gdb commandline, at which
point you can print the backtrace by using the `bt` command.

BTW: it is always helpful to mention, what commit are you actually
using. master moves so fast, that this issue might already be fixed by
Bram.

Otherwise, is there anything unusual with your system or operating
system?


Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Eva N. Gelium

John Little

unread,
Apr 22, 2020, 8:28:24 AM4/22/20
to vim_dev
On Tuesday, April 21, 2020 at 9:35:23 PM UTC+12, Andreas Plesner wrote:

> My school provide a server from which we can run code...


>BadAccess (attempt to access private resource denied)
>Vim: Got X error
>Vim: Finished.

(I'm guessing... the error suggests the X server is running as a different user from the vim user, or on a different host.  You might be able to solve this by some .Xauthority manipulation, or the brute force use of xhost.  I suggest reading the Xsecurity(7) man page.  These aspects of X are unknown by most, including me, and only a dim memory for most of the rest.)

I can report that I run vim with the change that Christian Brabandt has suggested to no ill effect, and have done so for many years.  I occasionally get BadWindow X errors when vim puts 256 kiB or more on the clipboard. (I've never been able to track it down, as it happens asynchronously.)  The one extra change I make is to add the line

    g_print("%s", IObuff);

that causes the error message to go to standard output, wherever that may be.  Without the preserve_exit() call the message doesn't otherwise appear anywhere.

I expect that vim's clipboard support will not work, though.  For editing files on a server, it may be easier to run vim locally, and use netrw to access the files.

HTH, John Little
Reply all
Reply to author
Forward
0 new messages