@@ -82,6 +82,32 @@ index 614795f..4671f1b 100755
82
82
fi
83
83
EOF
84
84
85
+ # When libedit receives a signal, it re-broadcasts it to its entire pgroup.
86
+ # This seems intended to preserve normal ^C behavior in "raw" mode when the
87
+ # terminal's ISIG flag is cleared? However, libedit does not in fact clear
88
+ # ISIG. (And Jack can't find any evidence of any version that ever did.) This
89
+ # sometimes results in the parent process receiving ^C twice back-to-back,
90
+ # depending on the vagaries of signal coalescing. More pathologically, if the
91
+ # parent tries to signal the child directly with e.g. `kill(pid, SIGTERM)`,
92
+ # libedit *signals the parent right back* (not to mention any other pgroup
93
+ # siblings or grandparents). This is just wild behavior, even though it's
94
+ # probably rare that it matters in practice. Patch it out. See also:
95
+ # https://github.com/astral-sh/uv/issues/13919#issuecomment-2960501229.
96
+ patch -p1 << "EOF "
97
+ diff --git i/src/sig.c w/src/sig.c
98
+ index d2b77e7..884b2dd 100644
99
+ --- i/src/sig.c
100
+ +++ w/src/sig.c
101
+ @@ -107,7 +107,7 @@ sig_handler(int signo)
102
+ sel->el_signal->sig_action[i].sa_flags = 0;
103
+ sigemptyset(&sel->el_signal->sig_action[i].sa_mask);
104
+ (void) sigprocmask(SIG_SETMASK, &oset, NULL);
105
+ - (void) kill(0, signo);
106
+ + (void) raise(signo);
107
+ errno = save_errno;
108
+ }
109
+ EOF
110
+
85
111
cflags=" ${EXTRA_TARGET_CFLAGS} -fPIC -I${TOOLS_PATH} /deps/include -I${TOOLS_PATH} /deps/include/ncursesw"
86
112
ldflags=" ${EXTRA_TARGET_LDFLAGS} -L${TOOLS_PATH} /deps/lib"
87
113
0 commit comments