From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65812: 29.1; Emacs client on Windows can't connect to the daemon on WSL over TCP Date: Fri, 08 Sep 2023 10:24:25 +0300 Message-ID: <83bkedxh3q.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10282"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65812@debbugs.gnu.org To: user@pontos Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 08 09:25:29 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qeVrs-0002PU-M8 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 08 Sep 2023 09:25:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qeVrR-0003Uw-2x; Fri, 08 Sep 2023 03:25:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qeVrQ-0003Tq-0x for bug-gnu-emacs@gnu.org; Fri, 08 Sep 2023 03:25:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qeVrP-0006RJ-Ob for bug-gnu-emacs@gnu.org; Fri, 08 Sep 2023 03:24:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qeVrR-0006zL-Ro for bug-gnu-emacs@gnu.org; Fri, 08 Sep 2023 03:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Sep 2023 07:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65812 X-GNU-PR-Package: emacs Original-Received: via spool by 65812-submit@debbugs.gnu.org id=B65812.169415788626833 (code B ref 65812); Fri, 08 Sep 2023 07:25:01 +0000 Original-Received: (at 65812) by debbugs.gnu.org; 8 Sep 2023 07:24:46 +0000 Original-Received: from localhost ([127.0.0.1]:42067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeVrC-0006yj-Di for submit@debbugs.gnu.org; Fri, 08 Sep 2023 03:24:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43188) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeVr8-0006yV-Gy for 65812@debbugs.gnu.org; Fri, 08 Sep 2023 03:24:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qeVr0-0006PG-MK; Fri, 08 Sep 2023 03:24:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=v3A1nqeHSmrcIJquJLExqX0Ma+oiCjDYFO08oaqP3vA=; b=EkRCwmI/g+xE lsTS7EBdzQHn0PHXrT9xjZQ/8RRb18wdz99oaQYeXVoxgmYIhnLIUQosuknX+1H0W6/6GRe+B+Iv7 JDWOVASBxMX/U9BALMiFInMP5IvLEa0WZ7CpteQL2crEk45xbXqOQu7NChrIZaR70r7LCt89SPGdt v9y69EwEKworUlDD04Qw61GOX9IbiIDRAEpyAJwcOqKlOKaBjP79xA1Jl++8YW13251dnbSbDNpy3 sEoMaEt7J0KjMShD2a4YGoCdjZ8KUoJhZj7uEnsm4Fk+UKY0oH5DWCNmYAA6/+o+E2aCraVTV1ayt isxhaIL+49zlLbwp9z+i1A==; In-Reply-To: (user@pontos) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:269733 Archived-At: > Date: Thu, 7 Sep 2023 15:10:59 -0400 > From: user@pontos > > I'm trying to connect Emacs client running on Windows over TCP to the Emacs > server running inside WSL. This is currently not supported, due to the various quirks and kludges we need to support the client-server protocol on MS-Windows. the patch below attempts to support this by adding one more kludge. > # Inside WSL shell: > (cat < (setq server-host "WSL_IP_ADDRESS_HERE") > (setq server-port 12345) > (setq server-use-tcp t) > (server-start) > EOF > ) > server-config.el > emacs -Q -l server-config.el --daemon > > # On Windows > # Map network drive \\wsl.localhost\Ubuntu as, e.g. W: > # Then in PowerShell: > $env:EMACS_SERVER_FILE=W:\home\user\.emacs.d\server\server > & 'C:\Program Files\Emacs\emacs-29.1\bin\emacsclientw.exe' -c -n > > Client will first display message window saying that it connected to the > remote socket, and after clicking [OK] button, error message appears > saying "*ERROR*: Could not open file: CONOUT$". Please try the patch below and tell if it solves your problem. The patch should be applied to the Emacs you run inside WSL, and you will need to byte-compile the patched server.el there, ensure the produced server.elc file replaces the one you installed with the original Emacs on WSL, and if Emacs you run on WSL also uses native-compilation, make sure the stale .eln file is not loaded (it should happen automatically, but for good measure just delete the old .eln file). diff --git a/lisp/server.el b/lisp/server.el index 104fc06..ee80b93 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1262,9 +1262,12 @@ server-process-filter ;; choice there.) In daemon mode on Windows, we can't ;; make tty frames, so force the frame type to GUI ;; there too. - (when (and (eq system-type 'windows-nt) - (or (daemonp) - (eq window-system 'w32))) + (when (or (and (eq system-type 'windows-nt) + (or (daemonp) + (eq window-system 'w32))) + ;; Client runs on Windows, but the server + ;; runs on a Posix host. + (equal tty-name "CONOUT$") (push "-window-system" args-left))) ;; -position +LINE[:COLUMN]: Set point to the given