unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: 52369@debbugs.gnu.org
Subject: bug#52369: 28.0.90; Assertion failure when running Flycheck unit test suite
Date: Sat, 11 Dec 2021 13:56:45 +0100	[thread overview]
Message-ID: <CAArVCkQa_VrCAuQGF9FJurVpcN+eCXCHqqBuExtWswi_khGXkw@mail.gmail.com> (raw)
In-Reply-To: <wvr48rwvebf1.fsf@gmail.com>

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

Am Mi., 8. Dez. 2021 um 09:43 Uhr schrieb Philipp Stephani
<p.stephani2@gmail.com>:
>
>
> With the emacs-28 branch (haven't checked other branches so far), an
> assertion failure consistently triggers when running the Flycheck unit
> test suite.  Unfortunately, I haven't been able to narrow down the
> problem any further so far.  To reproduce, clone the Flycheck repository
> from https://github.com/flycheck/flycheck (at commit
> 784f184cdd9f9cb4e3dbb997c09d93e954142842 in my case, though this
> probably doesn't matter much), and run the unit tests like
>
> export EMACS=...
> make init
> make unit
>
> With an Emacs built with --enable-checking, I then get the following
> assertion failure:
>
> [...]
>    passed  302/361  flycheck-set-checker-executable/non-existing-file (0.000481 sec)
>    passed  303/361  flycheck-set-checker-executable/real-executable (0.002321 sec)
>    passed  304/361  flycheck-standard-error-navigation/default-to-t (0.000198 sec)
>
> process.c:6521: Emacs fatal error: assertion failed: 0 <= outfd && outfd < FD_SETSIZE
> make: *** [Makefile:128: unit] Aborted (core dumped)
>

Given that this is a serious bug (undefined behavior), I'd install the
attached patch on the release branch.

[-- Attachment #2: 0001-Avoid-undefined-behavior-in-send-process-region-Bug-.patch --]
[-- Type: application/octet-stream, Size: 966 bytes --]

From d39bdfbb64c953bd9389f762443d15ecb4fb0cbb Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Sat, 11 Dec 2021 13:51:34 +0100
Subject: [PATCH] Avoid undefined behavior in 'send-process-region'
 (Bug#52369).

* src/process.c (send_process): Signal an error if the file descriptor
has already been closed.
---
 src/process.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/process.c b/src/process.c
index 75ba191fa1..1d307d5242 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6520,6 +6520,9 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
 	  /* Send this batch, using one or more write calls.  */
 	  ptrdiff_t written = 0;
 	  int outfd = p->outfd;
+          if (outfd < 0)
+            error ("Output file descriptor of %s is closed",
+                   SDATA (p->name));
 	  eassert (0 <= outfd && outfd < FD_SETSIZE);
 #ifdef DATAGRAM_SOCKETS
 	  if (DATAGRAM_CHAN_P (outfd))
-- 
2.30.1 (Apple Git-130)


  reply	other threads:[~2021-12-11 12:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08  8:41 bug#52369: 28.0.90; Assertion failure when running Flycheck unit test suite Philipp Stephani
2021-12-11 12:56 ` Philipp Stephani [this message]
2021-12-11 13:50   ` Eli Zaretskii
2021-12-11 18:26     ` Philipp
2023-09-06  1:58       ` Stefan Kangas

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAArVCkQa_VrCAuQGF9FJurVpcN+eCXCHqqBuExtWswi_khGXkw@mail.gmail.com \
    --to=p.stephani2@gmail.com \
    --cc=52369@debbugs.gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).