From a947c10d9093b9f3a29b60a52bda8afa43b6fd29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Giquel?= Date: Thu, 2 Jun 2022 11:38:56 +0200 Subject: [PATCH] Use `read-process-output-max' when creating pipes on GNU/Linux * src/process.c (syms_of_process): Note max size. (create_process): Set the pipe size from `read-process-output-max' (bug#55737). Copyright-paperwork-exempt: yes --- src/process.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/process.c b/src/process.c index fe3e12343f2..ccfc0bdf547 100644 --- a/src/process.c +++ b/src/process.c @@ -2145,6 +2145,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) inchannel = p->open_fd[READ_FROM_SUBPROCESS]; forkout = p->open_fd[SUBPROCESS_STDOUT]; +#if defined(GNU_LINUX) && defined(F_SETPIPE_SZ) + fcntl (inchannel, F_SETPIPE_SZ, read_process_output_max); +#endif + if (!NILP (p->stderrproc)) { struct Lisp_Process *pp = XPROCESS (p->stderrproc); @@ -8631,7 +8635,10 @@ returns non-nil. */); DEFVAR_INT ("read-process-output-max", read_process_output_max, doc: /* Maximum number of bytes to read from subprocess in a single chunk. Enlarge the value only if the subprocess generates very large (megabytes) -amounts of data in one go. */); +amounts of data in one go. + +On GNU/Linux systems, the value should not exceed +/proc/sys/fs/pipe-max-size. See pipe(7) manpage for details. */); read_process_output_max = 4096; DEFVAR_INT ("process-error-pause-time", process_error_pause_time, -- 2.39.2