bin/159226: [PATCH] Libedit does not always restore its signal
handler
AIDA Shinra
shinra at j10n.org
Wed Jul 27 10:30:10 UTC 2011
>Number: 159226
>Category: bin
>Synopsis: [PATCH] Libedit does not always restore its signal handler
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jul 27 10:30:08 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: AIDA Shinra
>Release: FreeBSD 7.3-RELEASE-p6 i386
>Organization:
>Environment:
System: FreeBSD sodans.usata.org 7.3-RELEASE-p6 FreeBSD 7.3-RELEASE-p6 #1: Mon Jun 27 01:58:42 JST 2011 wm3 at sodans.usata.org:/usr/obj/usr/src/sys/KERNEL_SODANS i386
>Description:
If a program gets the same signal twice in a single call to el_gets(), editline's internal signal handler is not used to the second one.
>How-To-Repeat:
I found this bug when testing CURRENT's BSD bc.
You can also reproduce the problem by inserting "printf" or "write" to libedit's sig_handler() and run ftp(1).
>Fix:
Apply the attached patch.
--- libedit-multisignal.diff begins here ---
--- /usr/src/lib/libedit/sig.c 2010-02-10 09:26:20.000000000 +0900
+++ sig.c 2011-07-17 13:31:47.000000000 +0900
@@ -94,9 +94,18 @@
if (signo == sighdl[i])
break;
- (void) signal(signo, sel->el_signal[i]);
+ if (sel->el_signal[i] != SIG_IGN && signo != SIGCONT) {
+ /* Deliver the signal to my original handler */
+ (void) signal(signo, sel->el_signal[i]);
+ (void) kill(getpid(), signo);
+ (void) sigfillset(&nset);
+ (void) sigdelset(&nset, signo);
+ (void) sigdelset(&nset, SIGCONT);
+ /* delever and maybe stop here */
+ (void) sigsuspend(&nset);
+ (void) signal(signo, sig_handler);
+ }
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
- (void) kill(0, signo);
}
--- libedit-multisignal.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list