unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61341: Tramp process truncate messages to 4096 bytes
@ 2023-02-07  3:36 Haiwei Zhou
  2023-02-17  9:27 ` Michael Albinus
  0 siblings, 1 reply; 2+ messages in thread
From: Haiwei Zhou @ 2023-02-07  3:36 UTC (permalink / raw)
  To: 61341

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

Hi,

  According to this link
<https://stackoverflow.com/questions/18015137/linux-terminal-input-reading-user-input-from-terminal-truncating-lines-at-4095>,
Linux terminals truncated messages to 4096 bytes under the tty canonical
mode. To fix this issue, the following patch will help. I tested on emacs
28.2 with tramp 2.5.3.

--- tramp-sh.el.orig	2022-05-12 19:59:16.000000000 +0800
+++ tramp-sh.el	2023-01-28 11:14:40.371519390 +0800
@@ -2959,7 +2959,7 @@
 			  ;; macOS, see Bug#50748.
 			  (when (and (memq connection-type '(nil pipe))
                                      (not (tramp-check-remote-uname v
"Darwin")))
-			    (tramp-send-command v "stty -icrnl"))
+			    (tramp-send-command v "stty -icrnl -icanon"))
 			  ;; `tramp-maybe-open-connection' and
 			  ;; `tramp-send-command-and-read' could have
 			  ;; trashed the connection buffer.  Remove this.



Thanks,
Haiwei

[-- Attachment #2: Type: text/html, Size: 1731 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#61341: Tramp process truncate messages to 4096 bytes
  2023-02-07  3:36 bug#61341: Tramp process truncate messages to 4096 bytes Haiwei Zhou
@ 2023-02-17  9:27 ` Michael Albinus
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Albinus @ 2023-02-17  9:27 UTC (permalink / raw)
  To: Haiwei Zhou; +Cc: 61341-done

Version: 29.2

Haiwei Zhou <highfly22@gmail.com> writes:

> Hi,

Hi,

>   According to this link, Linux terminals truncated messages to 4096
> bytes under the tty canonical mode. To fix this issue, the following
> patch will help. I tested on emacs 28.2 with tramp 2.5.3.
>
> --- tramp-sh.el.orig	2022-05-12 19:59:16.000000000 +0800
> +++ tramp-sh.el	2023-01-28 11:14:40.371519390 +0800
> @@ -2959,7 +2959,7 @@
>  			  ;; macOS, see Bug#50748.
>  			  (when (and (memq connection-type '(nil pipe))
>                                       (not (tramp-check-remote-uname v "Darwin")))
> -			    (tramp-send-command v "stty -icrnl"))
> +			    (tramp-send-command v "stty -icrnl -icanon"))
>  			  ;; `tramp-maybe-open-connection' and
>  			  ;; `tramp-send-command-and-read' could have
>  			  ;; trashed the connection buffer.  Remove this.

In general, your patch looks good. Since I don't use lsp-mode I cannot
check it there, but I trust you that it helps.

However, two enhancements must be done. First, it shall be applied for
remote macOS hosts as well. And secondly, when setting -icanon, one must
also set min and time.

Finally, I've changed this to

--8<---------------cut here---------------start------------->8---
			    (when (memq connection-type '(nil pipe))
			      (if (tramp-check-remote-uname v "Darwin")
				  (tramp-send-command
				   v "stty -icanon min 1 time 0")
				(tramp-send-command
				 v "stty -icrnl -icanon min 1 time 0")))
--8<---------------cut here---------------end--------------->8---

Pushed to the Emacs master branch. This patch will be contained also in
Tramp 2.6.0.2, scheduled for relase later this month on GNU ELPA.

Closing the bug.

> Thanks,
> Haiwei

Best regards, Michael.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-17  9:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07  3:36 bug#61341: Tramp process truncate messages to 4096 bytes Haiwei Zhou
2023-02-17  9:27 ` Michael Albinus

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).