From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#6149: bug#24531: process-send-string seems to truncate lines over 4096 characters Date: Thu, 27 Jul 2023 09:59:53 -0400 Message-ID: References: <87aas81jgh.fsf@jidanni.org> <83sf9h257b.fsf@gnu.org> <19e73ab0-19b5-d7f4-8912-20c9e822e3fb@gutov.dev> <83r0otnc67.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22749"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 6149@debbugs.gnu.org, Dmitry Gutov , Paul Eggert , monnier@iro.umontreal.ca, jidanni@jidanni.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 27 16:07:28 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 1qP1eK-0005k2-3e for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Jul 2023 16:07:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP1YB-0005Xz-IX; Thu, 27 Jul 2023 10:01:07 -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 1qP1Y9-0005XT-0t for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2023 10:01:05 -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 1qP1Y6-00076O-Hp for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2023 10:01:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qP1Y6-0005Ii-1x for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2023 10:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Jul 2023 14:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6149 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 6149-submit@debbugs.gnu.org id=B6149.169046640220203 (code B ref 6149); Thu, 27 Jul 2023 14:01:02 +0000 Original-Received: (at 6149) by debbugs.gnu.org; 27 Jul 2023 14:00:02 +0000 Original-Received: from localhost ([127.0.0.1]:42751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qP1X7-0005FK-Op for submit@debbugs.gnu.org; Thu, 27 Jul 2023 10:00:02 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:44839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qP1X4-0005F6-R9 for 6149@debbugs.gnu.org; Thu, 27 Jul 2023 10:00:00 -0400 In-Reply-To: <83r0otnc67.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 27 Jul 2023 08:41:52 +0300") 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:266193 Archived-At: Eli Zaretskii writes: >> Date: Thu, 27 Jul 2023 04:48:18 +0300 >> Cc: 24531@debbugs.gnu.org, 6149@debbugs.gnu.org, >> Stefan Monnier , jidanni@jidanni.org >> From: Dmitry Gutov >> >> If some syscall or etc limits the length of a string to 4096, can't we >> detect this case, split the string and emit said call multiple times? >> >> This function's docstring already mentions the case of >> >> If STRING is larger than the input buffer of the process, ... >> it is sent in several bunches Alas it's far more cursed than that. The length of a *line* is limited to 4096 characters. So regardless of how big or small your buffers for writing are, if you write more than 4095 characters before writing a newline, the remaining characters will be discarded. There is no way to prevent this with ptys. So even if we wrote one character at a time, characters would start getting dropped after writing 4095 non-newline characters. > > AFAIU, that is based on the errno value returned by a 'write' call > which attempts to write too many bytes (see the would_block function). > I guess writes to PTYs don't do that? Writes to PTYs do tell us when the data has been truncated. There's just nothing we can do with that information.