From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: APEL Martin <Martin.APEL@3ds.com>,
Thomas Ross <thomasross@thomasross.io>,
yyoncho <yyoncho@gmail.com>,
"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Tramp and conversion of \r\n into \n
Date: Thu, 12 Aug 2021 20:47:15 +0200 [thread overview]
Message-ID: <87wnoqv6to.fsf@gmx.de> (raw)
In-Reply-To: <87r1f4rp29.fsf@gmx.de> (Michael Albinus's message of "Sun, 08 Aug 2021 16:25:34 +0200")
[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]
>> I guess if we wanted to more faithfully simulate a pipe, we'd have to
>> send the process input via something like a base64 decoder and get the
>> output via a base64 encoder: this way not only stdin/stdout is a pipe but
>> we can protect ourselves from the way ttys can mess with some bytes (as
>> seen in this thread) and also overcome some of the limits of some ttys
>> when sending "large" amounts of data at a time (IIRC on some systems
>> this can either freeze the tty or the tty may insert extra chars like
>> ^A or some such; my memory says the macOS kernel was such a culprits
>> some years ago).
>>
>> The cure way be worse than the disease, tho.
>
> Yes.
>
> Maybe we could play with "stty raw", when
> (tramp-)process-connection-type is nil or 'pipe.
It looks like "stty -icrnl" suppresses the \r\n conversion in a shell. I
have adapted Tramp to send this command to a remote async process, when
connection type is nil or 'pipe. The Tramp documentation has a new
subsection now:
--8<---------------cut here---------------start------------->8---
6.5.7 Remote process connection type
Asynchronous processes differ in the way, whether they use a pseudo tty,
or not. This is controlled by the variable ‘process-connection-type’,
which can be ‘t’ or ‘pty’ (use a pseudo tty), or ‘nil’ or ‘pipe’ (don’t
use it). TRAMP is based on running shells on the remote host, which
require a pseudo tty. Therefore, it declares the variable
‘tramp-process-connection-type’, which carries this information for
remote processes. Per default, its value is ‘t’. The name of the
remote pseudo tty is returned by the function ‘process-tty-name’.
If a remote process, started by ‘start-file-process’, shouldn’t use a
pseudo tty, this is emulated by let-binding this variable to ‘nil’ or
‘pipe’. There is still a pseudo tty for the started process, but some
terminal properties are changed, like suppressing translation of
carriage return characters into newline.
The function ‘make-process’ allows an explicit setting by the
‘:connection-type’ keyword. If this keyword is not used, the value of
‘tramp-process-connection-type’ is applied instead.
--8<---------------cut here---------------end--------------->8---
The Tramp test suite has been extended in order to test this, see
tramp-test30-make-process. Committed to Emacs master, and will also be
available with next Tramp 2.5.1.2 on GNU ELPA.
Thomas, could you test this, again? I guess the following patch is all
what's needed in lsp-mode:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1523 bytes --]
*** /home/albinus/.emacs.d/elpa/lsp-mode-20210802.619/lsp-mode.el.~1~ 2021-08-05 17:13:45.133161987 +0200
--- /home/albinus/.emacs.d/elpa/lsp-mode-20210802.619/lsp-mode.el 2021-08-12 20:41:28.232443184 +0200
***************
*** 6956,6962 ****
(format "/tmp/%s-%s-stderr" name
(cl-incf lsp--stderr-index))))))))
(process-environment
! (lsp--compute-process-environment environment-fn)))
(let ((proc (start-file-process-shell-command process-name
(format "*%s*" process-name)
wrapped-command)))
--- 6956,6963 ----
(format "/tmp/%s-%s-stderr" name
(cl-incf lsp--stderr-index))))))))
(process-environment
! (lsp--compute-process-environment environment-fn))
! (tramp-process-connection-type 'pipe))
(let ((proc (start-file-process-shell-command process-name
(format "*%s*" process-name)
wrapped-command)))
[-- Attachment #3: Type: text/plain, Size: 24 bytes --]
Best regards, Michael.
next prev parent reply other threads:[~2021-08-12 18:47 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 7:46 Tramp and conversion of \r\n into \n APEL Martin
2020-12-11 9:15 ` Michael Albinus
2020-12-11 9:59 ` APEL Martin
2020-12-11 10:26 ` Michael Albinus
2020-12-11 11:29 ` APEL Martin
2020-12-11 11:52 ` Michael Albinus
2020-12-13 16:04 ` Michael Albinus
2020-12-15 11:37 ` Michael Albinus
2020-12-15 12:45 ` APEL Martin
2020-12-15 14:37 ` Michael Albinus
2020-12-15 18:45 ` Michael Albinus
2020-12-16 6:44 ` APEL Martin
2020-12-16 15:34 ` Michael Albinus
2020-12-16 15:55 ` APEL Martin
2020-12-17 11:35 ` APEL Martin
2020-12-17 12:50 ` Michael Albinus
2020-12-18 7:48 ` APEL Martin
2020-12-18 12:35 ` Michael Albinus
2020-12-18 12:56 ` APEL Martin
2020-12-18 13:04 ` Michael Albinus
2020-12-18 14:54 ` APEL Martin
2020-12-18 15:00 ` Michael Albinus
2020-12-18 15:10 ` APEL Martin
2020-12-18 15:18 ` Michael Albinus
2020-12-22 14:57 ` Michael Albinus
2021-01-07 11:13 ` APEL Martin
2020-12-19 9:18 ` yyoncho
2020-12-19 16:48 ` Michael Albinus
2020-12-20 14:03 ` Michael Albinus
2021-08-05 1:46 ` Thomas Ross
2021-08-05 6:16 ` Eli Zaretskii
2021-08-07 2:08 ` Thomas Ross
2021-08-05 14:10 ` Stefan Monnier
2021-08-05 15:40 ` Michael Albinus
2021-08-05 16:25 ` Stefan Monnier
2021-08-06 7:13 ` Michael Albinus
2021-08-06 14:46 ` Stefan Monnier
2021-08-07 13:51 ` Michael Albinus
2021-08-07 22:04 ` Stefan Monnier
2021-08-08 6:13 ` PTYs vs. pipes for subprocesses [was: Tramp and conversion of \r\n into \n] tomas
2021-08-08 14:25 ` Tramp and conversion of \r\n into \n Michael Albinus
2021-08-12 18:47 ` Michael Albinus [this message]
2021-08-13 12:16 ` Michael Albinus
2021-08-07 2:07 ` Thomas Ross
2021-08-07 13:54 ` Michael Albinus
2021-08-08 14:29 ` Michael Albinus
-- strict thread matches above, loose matches on Subject: below --
2020-12-09 7:34 yyoncho
2020-12-10 13:44 ` Michael Albinus
2020-12-11 14:11 ` yyoncho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wnoqv6to.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=Martin.APEL@3ds.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=thomasross@thomasross.io \
--cc=yyoncho@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).