| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org A8E793971C12 |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
| s=default; t=1606403932; | |
| bh=jn/L/9IHUt22eACJLFrVA6o738emGctcl34c96KOamA=; | |
| h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: | |
| List-Help:List-Subscribe:From:Reply-To:From; | |
| b=Qi6boyeSWf2vx0IyC0KBspkSGSjVov+n+f3Yu9tI7D9wGmBYZyeU/zFeQGNH1rto7 | |
| 3Ov805w7k4Dhu5LWNUkNYeLUMeuZW2aetT9DYqXj2WNIiHBpKxBsibEJDaDDq7kUg4 | |
| a5Hpc6RI1OUD2cbAWeR6TXQpKRdcZlhwpecmA0+0= | |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DMARC-Filter: | OpenDMARC Filter v1.3.2 sourceware.org 4AF333857C4F |
| X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
| d=1e100.net; s=20161025; | |
| h=x-gm-message-state:mime-version:from:date:message-id:subject:to; | |
| bh=tvaulf6NeZJdTl9zLZfQ4dKy/CIwDUoIRjhqWk87nQI=; | |
| b=BDfPlFtgyueuiiq9GZYvq9Gt1f2TGMFNqeom5QE5nhMjhhRLcVkqyYNnnOOWowUJa9 | |
| 37juzTzYy12B1+KzSgQTUI/uv7GCmOquJxvpnVdt36Oztc+3Mbg9Kr0DuxjodV8L0/51 | |
| dbYPSu9zwNgqjBL0b7Y592R0VK4ur6H/JYKK9NE/fbvN8nsxYus2fTCczq5wIy0S37cw | |
| jQaJqck/cMz5YojrtfblC/zFtQGOjiADFxpeh8jVBJiqRniIRb2pvsR/euBQg8Qccqk8 | |
| doKSOxcbEnS5blIRHVKd2tBExtmMNn5e00XGYaqEH07vQGIMtTnIFVp91UKCSmMdOKx8 | |
| RyJw== | |
| X-Gm-Message-State: | AOAM532nY29o5ySiFGXhjsRKxN56GZH/F3fSJHc+F2qGXnpjbjhzAEt3 |
| NWTjiOR9ECSX0A6cTLkE5PPfzgXwj+blD+Ruo+B8qK2/9wnKNg== | |
| X-Google-Smtp-Source: | ABdhPJxxI80deajlqh5NtJe49rXmbPIH4bmVcqQ6h8MG49bpqYVpPv1akPm1oQg8AuuwqAvPHMydJdG8JLU7xc36n9I= |
| X-Received: | by 2002:a05:6830:1dab:: with SMTP id |
| z11mr2587287oti.247.1606403928428; | |
| Thu, 26 Nov 2020 07:18:48 -0800 (PST) | |
| MIME-Version: | 1.0 |
| Date: | Thu, 26 Nov 2020 17:18:37 +0200 |
| Message-ID: | <CAFNJpniCb6AMojTH=MCK=tNqWuOxS64ie=5UV5A8zyJAY2UWYw@mail.gmail.com> |
| Subject: | Help with setting Cygwin's Emacs W32 TRAMP to WSL 1 |
| To: | cygwin AT cygwin DOT com |
| X-Spam-Status: | No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, |
| DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, | |
| KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, | |
| TXREP autolearn=no autolearn_force=no version=3.4.2 | |
| X-Spam-Checker-Version: | SpamAssassin 3.4.2 (2018-09-13) on |
| server2.sourceware.org | |
| X-BeenThere: | cygwin AT cygwin DOT com |
| X-Mailman-Version: | 2.1.29 |
| List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
| List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
| List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
| From: | Oleksandr Gavenko via Cygwin <cygwin AT cygwin DOT com> |
| Reply-To: | Oleksandr Gavenko <gavenkoa AT gmail DOT com> |
| Sender: | "Cygwin" <cygwin-bounces AT cygwin DOT com> |
| Note-from-DJ: | This may be spam |
I'm using Cygwin for two reasons: mintty + Emacs w32.
Nowadays WSL 1 has become important (vendors provide ready to work
.deb packages,
I use: Ansible + Google Cloud SDK, if name any).
Still WSL 1 lacks UI and integrates less smoothly into my workflow
to replace Cygwin's amazing Emacs W32.
WSL1 files are "hidden" for regular access.
Emacs has TRAMP mode to access foreign environments:
https://www.gnu.org/software/tramp/
I tried to define configuration that should have allowed to access WSL 1
from Cygwin's Emacs via "wsl sh" jump (the way TRAMP support "su" &
"sudo" jumps):
* https://www.reddit.com/r/emacs/comments/jrkgmy/tramp_for_wsl_1_from_cygwin_emacsw32/
* https://github.com/microsoft/WSL/issues/6236
- wsl.exe periodically sends control characters making impossible "piping"
via interactive/terminal mode
The problem is that when Cygwin's Emacs invokes "wsl.exe" conhost or
wsl?? thinks
it is in a PTY mode and sends different "clearing" terminal escape
sequences (see WSL issue report).
I reproduce garbage with Elisp code:
(setq xxx (make-process :name "xxx" :buffer "xxx" :command '("wsl"
"echo" "OK") :connection-type 'pty))
(stop-process xxx)
Note that changing the last argument "pty" => "pipe" solves the problem,
but things are a bit complicated...
TRAMP mode has been implemented via call to "sh" by internal API "make-process".
And then TRAMP sends "wsl ..." to the shell so WSL thinks it is in
PTY and I have no way
to influence that decision ((
I tried stupid tricks like passing everything related to "ws.exe" via
pipe to "cat":
(with-eval-after-load 'tramp
(setf (alist-get "wsl" tramp-methods nil nil #'equal)
'((tramp-login-program "sh")
(tramp-login-args (("-c") ("wsl") ("-u" "%u") ("-d" "%h")
("|" "cat")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10)
(tramp-session-timeout 300))))
or define a wrapper script that has "wsl ... | cat" inside. Nothing helped.
Few experiments with Cygwin's Expect also failed as I forgot
everything about that obscure tech...
So I need to write some wrapper that will bidirectionally pipe to "wsl.exe"
putting wsl into piped instead TTY mode.
It can be that there is a ready solution.
If not please advise which API should I use to write such a wrapper.
Should it be Cygwin's pipe/dup2/fork/execvp or popen?
Or should it be Windows native CreateChildProcess / WriteToPipe /
ReadFromPipe as here:
https://docs.microsoft.com/en-us/windows/win32/procthread/creating-a-child-process-with-redirected-input-and-output
Please CC me in replies, I'll check the mail archive after a week to
not lose any responses.
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |