GNU bug report logs - #61341
Tramp process truncate messages to 4096 bytes

Previous Next

Package: emacs;

Reported by: Haiwei Zhou <highfly22 <at> gmail.com>

Date: Tue, 7 Feb 2023 08:01:02 UTC

Severity: normal

Fixed in version 29.2

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61341 in the body.
You can then email your comments to 61341 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61341; Package emacs. (Tue, 07 Feb 2023 08:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Haiwei Zhou <highfly22 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 07 Feb 2023 08:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Haiwei Zhou <highfly22 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Tramp process truncate messages to 4096 bytes
Date: Tue, 7 Feb 2023 11:36:49 +0800
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]

Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Fri, 17 Feb 2023 09:28:02 GMT) Full text and rfc822 format available.

Notification sent to Haiwei Zhou <highfly22 <at> gmail.com>:
bug acknowledged by developer. (Fri, 17 Feb 2023 09:28:02 GMT) Full text and rfc822 format available.

Message #10 received at 61341-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Haiwei Zhou <highfly22 <at> gmail.com>
Cc: 61341-done <at> debbugs.gnu.org
Subject: Re: bug#61341: Tramp process truncate messages to 4096 bytes
Date: Fri, 17 Feb 2023 10:27:16 +0100
Version: 29.2

Haiwei Zhou <highfly22 <at> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 17 Mar 2023 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.