[Bug 287452] libedit re-broadcasts signals to its entire pgroup, potentially including its parent

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 11 Jun 2025 15:51:52 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287452

            Bug ID: 287452
           Summary: libedit re-broadcasts signals to its entire pgroup,
                    potentially including its parent
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: oconnor663@gmail.com

We use the Linux port of libedit in "standalone" Python builds:

https://www.thrysoee.dk/editline/
https://github.com/astral-sh/python-build-standalone

We've noticed some unexpected signal handling behavior, which we're considering
patching downstream. Here's our proposed patch and repro notes:

https://github.com/astral-sh/python-build-standalone/pull/652

In short, after catching a signal and restoring the terminal to "cooked" mode,
libedit re-raises the signal with `kill(0, ...)`, which signals its entire
process group. Depending on how things are set up, this can "reflect" signals
back at the parent, which seems like it must be unintended. However, as far as
I can tell this behavior has been in place for 30 years, and I can't find any
version of libedit that didn't do it, so there's a strong chance I'm
misunderstanding why it's there. I wanted to report this patch upstream in case
you wanted to consider taking it, or in case you had any corrections. This is
my first time opening a FreeBSD PR, so apologies if I've made a mess of it :)

- Jack

-- 
You are receiving this mail because:
You are the assignee for the bug.