GNU bug report logs - #79436
[PATCH] Use up-to-date time in wait_reading_process_output

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Fri, 12 Sep 2025 15:40:03 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: 79436 <at> debbugs.gnu.org
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, Dmitry Gutov <dmitry <at> gutov.dev>
Subject: bug#79436: [PATCH] Use up-to-date time in wait_reading_process_output
Date: Fri, 12 Sep 2025 11:38:29 -0400
[Message part 1 (text/plain, inline)]
Tags: patch


Compile the following C program, close_and_sit.c:

#include <stdio.h>
#include <unistd.h>
void main() {
  fclose(stdout);
  fclose(stderr);
  while (1) sleep(1);
}

Then run this snippet of Lisp, updating the executable file name
appropriately:

(make-process
 :name "close_and_sit"
 :command '("./close_and_sit")
 :connection-type 'pipe)
(make-process :name "true" :command '("true"))
(message "accept-process-output")
(accept-process-output nil 1)

This will cause Emacs to hang; accept-process-output will never time
out.

There are two bugs which combine to cause this.

The first bug is in our timeout handling.  The attached patch resolves
that, which causes accept-process-output to time out properly and fixes
the bug.

Paul, this patch partially reverts a change you made to cache
current_timespec.  Does it seem right to you?

The second bug is that when a child process closes stdout/stderr, we
continue watching the pipe, generating spurious events.  (We should
still be timing out despite the spurious events - real events could also
cause this hang, this bug just makes it easier to trigger the hang.)
I'm still working on a patch to fix the second bug.

[0001-Use-up-to-date-time-in-wait_reading_process_output.patch (text/patch, attachment)]

This bug report was last modified 6 days ago.

Previous Next


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