[vim/vim] "gvim --remote-tab-silent" seems to be broken under version 9.1.1623 (Issue #17982)

33 views
Skip to first unread message

thunderbird-1990

unread,
Aug 13, 2025, 3:13:17 AM8/13/25
to vim/vim, Subscribed
thunderbird-1990 created an issue (vim/vim#17982)

Steps to reproduce

touch 1.txt 2.txt 
gvim --remote-tab-silent 1.txt
gvim --remote-tab-silent 2.txt

Expected behaviour

I expected both files to be opened under the same instance of gVim as separate tabs. They are instead opened in separate gVim instances/windows.

This is not a problem under version 9.1.1552 (I downgraded both gvim and vim-runtime to 9.1.1552, and the issue does not exist).

Also this might be related to #17747:

gvim -g --servername TEST
gvim -g --serverlist

returns nothing under version 9.1.1623, but TEST under version 9.1.1552.

Version of Vim

9.1.1623

Environment

Arch Linux, KDE Plasma 6.4.4, KWin (Wayland)

Logs and stack traces


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982@github.com>

Foxe Chen

unread,
Aug 14, 2025, 6:58:42 PM8/14/25
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#17982)

@thunderbird-1990 Any follow up?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/3190102444@github.com>

thunderbird-1990

unread,
Sep 1, 2025, 2:43:13 AM9/1/25
to vim/vim, Subscribed
thunderbird-1990 left a comment (vim/vim#17982)

I can confirm this is not a problem with gVim 9.1.1623, Arch Linux, and XFCE (X11).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/3241049445@github.com>

Christian Brabandt

unread,
Sep 1, 2025, 3:52:34 AM9/1/25
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17982)

so this is still happening?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/3241259425@github.com>

thunderbird-1990

unread,
Sep 2, 2025, 12:44:56 AM9/2/25
to vim/vim, Subscribed
thunderbird-1990 left a comment (vim/vim#17982)

As of today, yes, this is still happening with gVim 9.1.1623, Arch, and KDE (Wayland). But not with XFCE (X11).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/3243761169@github.com>

Petr Menšík

unread,
Mar 10, 2026, 2:05:35 PM (8 days ago) Mar 10
to vim/vim, Subscribed
pemensik left a comment (vim/vim#17982)

Hi! It happens to me also, I have VIM - Vi IMproved 9.2 (2026 Feb 14, compiled Mar 06 2026 00:00:00) on Fedora, with +wayland and +clientserver enabled.

I created alias alias gvimt='gvim --servername "GVIM-$(pwd)" --remote-tab-silent' to open files from the same project. It used to work, but stopped after upgrade to Fedora 43.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4033416653@github.com>

dezza

unread,
Mar 10, 2026, 2:10:03 PM (8 days ago) Mar 10
to vim/vim, Subscribed
dezza left a comment (vim/vim#17982)

Can any of you guys try to debug print to see where it goes wrong; check #17839
Insert for example
fprintf(stdout, "reached %d", "1"); fflush()

The wayland clientserver is relatively new, maybe you can read fron the source where it could be problematic.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4033440945@github.com>

Petr Menšík

unread,
Mar 10, 2026, 2:15:28 PM (8 days ago) Mar 10
to vim/vim, Subscribed
pemensik left a comment (vim/vim#17982)

I have never compiled vim myself, use normal package. I will ask @zdohnal to reproduce it with sources. This one should be relatively simple to reproduce. I am using gvim, which I think used some X based interface instead.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4033470926@github.com>

Christian Brabandt

unread,
Mar 10, 2026, 2:28:42 PM (8 days ago) Mar 10
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17982)

have you tried the socketserver then?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4033550035@github.com>

Petr Menšík

unread,
Mar 10, 2026, 2:44:03 PM (8 days ago) Mar 10
to vim/vim, Subscribed
pemensik left a comment (vim/vim#17982)

yes, socket client server seems to be working as expected. Except it does not accept working directory path the same way as x11 did. Can I use working directory as part of --servername with --clientserver socket? How do I do that?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4033650224@github.com>

Petr Menšík

unread,
Mar 10, 2026, 3:15:00 PM (8 days ago) Mar 10
to vim/vim, Subscribed
pemensik left a comment (vim/vim#17982)

Hmm, servername with socket backend deletes unconditionally the given path. I am lucky it could not delete my --servername "$PWD", because the directory is used in that case. Perhaps it should use stat() to check existing types and refuse to start, when path is directory or normal file? I think user does not want to get it deleted, if he gives path to existing file by mistake.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4033817290@github.com>

Petr Menšík

unread,
Mar 11, 2026, 12:20:08 PM (7 days ago) Mar 11
to vim/vim, Subscribed
pemensik left a comment (vim/vim#17982)

I would have expected there would be compatible naming possibility for new and old methods. But have not found how to include working directory name into servername. Tried this:

# does not open new server, terminates without opening gvim
gvim -f --servername "$(pwd)/.vim-server.sock" --clientserver socket --remote-tab-silent file1
# does open new server and gvim editor
gvim -f --servername "$(pwd)/.vim-server.sock" --clientserver x11 --remote-tab-silent file1


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4040403055@github.com>

Foxe Chen

unread,
Mar 11, 2026, 12:41:23 PM (7 days ago) Mar 11
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#17982)

I would have expected there would be compatible naming possibility for new and old methods. But have not found how to include working directory name into servername. Tried this:

# does not open new server, terminates without opening gvim
gvim -f --servername "$(pwd)/.vim-server.sock" --clientserver socket --remote-tab-silent file1
# does open new server and gvim editor
gvim -f --servername "$(pwd)/.vim-server.sock" --clientserver x11 --remote-tab-silent file1

Problem is that the socketserver cannot have slashes in it unless it starts with "./", "../", or "/". Maybe you can replace the slashes with "%" characters?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4040551813@github.com>

Petr Menšík

unread,
Mar 11, 2026, 12:56:00 PM (7 days ago) Mar 11
to vim/vim, Subscribed
pemensik left a comment (vim/vim#17982)

$(pwd) starts with "/" on any system I know. It uses unix socket with path specified. It should be safe, right? Of course I can transliterate password to not contain slashes, but I wanted the actual socket to reside in my working directory.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4040652728@github.com>

Foxe Chen

unread,
Mar 11, 2026, 1:23:30 PM (7 days ago) Mar 11
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#17982)

$(pwd) starts with "/" on any system I know. It uses unix socket with path specified. It should be safe, right? Of course I can transliterate password to not contain slashes, but I wanted the actual socket to reside in my working directory.

Does this patch fix your issue?

diff --git a/src/clientserver.c b/src/clientserver.c
index ae5130dd3..b5f8d678b 100644
--- a/src/clientserver.c
+++ b/src/clientserver.c
@@ -300,6 +300,15 @@ prepare_server(mparm_T *parmp)
 #  endif
 	vim_free(parmp->servername);
     }
+#ifdef FEAT_SOCKETSERVER
+    // We don't need to delay starting the socket server, so start it
+    // immediately.
+    else if (clientserver_method == CLIENTSERVER_METHOD_SOCKET)
+    {
+	if (socket_server_init(parmp->servername) == OK)
+	    TIME_MSG("initialize socket server");
+    }
+#endif
 #  ifdef FEAT_X11
     else
 	serverDelayedStartName = parmp->servername;
diff --git a/src/os_unix.c b/src/os_unix.c
index 3bd2942ca..2756e2f52 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -9113,6 +9113,8 @@ socket_server_init(char_u *name)
     int			num_printed;
     int			fd;
     int			i = 1;
+    bool		explicit = false;
+    bool		success = false;
 
     if (socket_server_valid() || (name == NULL && socket_server_path == NULL))
 	return FAIL;
@@ -9138,8 +9140,11 @@ socket_server_init(char_u *name)
     // socket.
     if (name[0] == '/' || STRNCMP(name, "./", 2) == 0 ||
 	    STRNCMP(name, "../", 3) == 0)
+    {
 	num_printed =
 	    vim_snprintf((char *)path, sizeof(addr.sun_path), "%s", name);
+	explicit = true;
+    }
     else
     {
 	const char_u	*dir;
@@ -9207,11 +9212,11 @@ socket_server_init(char_u *name)
 
     vim_snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path);
 
-    // Bind to a suitable path/address
-    while (i < 1000)
+    // Bind to a suitable path/address, do not loop if path is explicitly
+    // provided.
+    do
     {
-	if (bind(fd, (struct sockaddr *)&addr, sizeof(addr))
-		== -1)
+	if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1)
 	{
 	    int fd2;
 
@@ -9227,13 +9232,17 @@ socket_server_init(char_u *name)
 	    if (fd2 == -1)
 	    {
 		mch_remove(addr.sun_path);
+		i++;
 		continue;
 	    }
 	    else
 		close(fd2);
 	}
 	else
+	{
+	    success = true;
 	    break;
+	}
 
 	num_printed = vim_snprintf(addr.sun_path, sizeof(addr.sun_path),
 		"%s%d", path, i);
@@ -9246,9 +9255,9 @@ socket_server_init(char_u *name)
 	}
 
 	i++;
-    }
+    } while (!explicit && i < 1000);
 
-    if (i >= 1000)
+    if (!success)
     {
 	emsg(_(e_socket_server_unavailable));
 	goto fail;


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4040827889@github.com>

Foxe Chen

unread,
Mar 11, 2026, 1:33:03 PM (7 days ago) Mar 11
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#17982)

It also seems that if the GTK gui is running under Wayland, then the X11 clientserver backend does not work. Just want to point that out


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4040896885@github.com>

Foxe Chen

unread,
Mar 15, 2026, 10:07:15 AM (3 days ago) Mar 15
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#17982)

cc @pemensik


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4063061587@github.com>

Petr Menšík

unread,
Mar 17, 2026, 11:18:42 AM (17 hours ago) Mar 17
to vim/vim, Subscribed
pemensik left a comment (vim/vim#17982)

$(pwd) starts with "/" on any system I know. It uses unix socket with path specified. It should be safe, right? Of course I can transliterate password to not contain slashes, but I wanted the actual socket to reside in my working directory.

Does this patch fix your issue?

Yes, it stops endless loop when directory is used as a server path. I think it should print some error message also, but it does not print anything.

Used for testing:

#!/bin/sh
# https://github.com/vim/vim/issues/17982
: ${SERVER:=socket}
: ${SERVERNAME:="$(pwd|tr / %)"}
: ${VIM:=gvim}

echo file1 > /tmp/file1
echo file2 > /tmp/file2

$VIM -f --servername "$SERVERNAME" --clientserver $SERVER --clean --remote-tab-silent /tmp/file1 &
PID1=$!
sleep 1
$VIM -f --servername "$SERVERNAME" --clientserver $SERVER --clean --remote-tab-silent /tmp/file2 &
PID2=$!
sleep 5
kill $PID1 $PID2


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4075780664@github.com>

Petr Menšík

unread,
Mar 17, 2026, 11:23:27 AM (17 hours ago) Mar 17
to vim/vim, Subscribed
pemensik left a comment (vim/vim#17982)

but absolute or relative path to unix socket does not seem to work. "$(pwd|tr / %)/.vim.sock" works, but "$(pwd)/.vim.sock" does not. Nor does ./.vim.sock.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4075814102@github.com>

Foxe Chen

unread,
Mar 17, 2026, 9:15:06 PM (8 hours ago) Mar 17
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#17982)

It looks like the problem is that the socket server needs to become a server itself, so it creates one, but then connects to itself, then Vim exits thinking there was a server. I think this would require refactoring the existing code a bit, I will create a PR for this (might take a while).


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17982/4078991412@github.com>

Reply all
Reply to author
Forward
0 new messages