all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 24531@debbugs.gnu.org, 6149@debbugs.gnu.org, jidanni@jidanni.org
Subject: bug#6149: bug#24531: process-send-string seems to truncate lines over 4096 characters
Date: Thu, 20 Jul 2023 16:15:11 -0400	[thread overview]
Message-ID: <ier4jlywd9s.fsf_-_@janestreet.com> (raw)
In-Reply-To: <jwv6323wmhk.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 31 May 2010 21:50:37 -0400")

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


I see that this bug is about 13 years old.  I think there's a pretty
obvious solution: process-connection-type should default to nil.
Otherwise this is a footgun just waiting to happen for anyone writing
process-interaction code in Emacs.

But if we don't do that, we should at least document it.  See my
attached patch.

Btw, just to feed the fire, here's my own reproducer:

(with-temp-buffer
  (make-process :name "broken" :buffer (current-buffer) :command '("cat"))
  (process-send-string nil (make-string 10000 ?x))
  (process-send-eof)
  (sit-for 1)
  (cons (point-min) (point-max)))


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Include-warning-about-long-line-truncation-in-proces.patch --]
[-- Type: text/x-patch, Size: 1285 bytes --]

From dcfd129b3f08273a8b0705f03b6074443a7a33c1 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
Date: Thu, 20 Jul 2023 16:13:56 -0400
Subject: [PATCH] Include warning about long line truncation in
 process-send-string

Maybe we can't fix this.  But we can at least warn the user about it!
To have no warning anywhere about this default behavior which silently
discards data, is very user-hostile.

* src/process.c (Fprocess_send_string): Include a warning about long
line truncation (bug#6149)
---
 src/process.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/process.c b/src/process.c
index 67d1d3e425f..82ace1b3a41 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6755,6 +6755,8 @@ DEFUN ("process-send-string", Fprocess_send_string, Sprocess_send_string,
 of which depends on the process connection type and the operating
 system), it is sent in several bunches.  This may happen even for
 shorter strings.  Output from processes can arrive in between bunches.
+If the process connection type is `pty', then long lines present in
+STRING may be truncated depending on the operating system.
 
 If PROCESS is a non-blocking network process that hasn't been fully
 set up yet, this function will block until socket setup has completed.  */)
-- 
2.39.3


  reply	other threads:[~2023-07-20 20:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10  4:14 bug#6149: 24.0.50; shell buffer overflow when input longer than 4096 bytes jidanni
2010-06-01  1:50 ` Stefan Monnier
2023-07-20 20:15   ` Spencer Baugh [this message]
2023-07-20 21:21     ` bug#6149: bug#24531: process-send-string seems to truncate lines over 4096 characters Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-21  5:39       ` Eli Zaretskii
2023-07-21 13:58         ` Spencer Baugh
2023-07-21 14:18           ` Eli Zaretskii
2023-07-27  1:48           ` bug#6149: " Dmitry Gutov
2023-07-27  5:41             ` Eli Zaretskii
2023-07-27 13:59               ` Spencer Baugh
2023-07-27 14:51                 ` Paul Eggert
2023-07-21 15:09         ` bug#24531: " Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2018-09-28 20:13 ` bug#6149: 24.0.50; shell buffer overflow when input longer than 4096 bytes Charles A. Roelli

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ier4jlywd9s.fsf_-_@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=24531@debbugs.gnu.org \
    --cc=6149@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.