Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Chris Down Newsgroups: gnu.bash.bug Subject: Re: Change in SIGTERM behaviour in bash 4.3 when using readline Date: Wed, 4 Mar 2020 19:29:18 +0000 Lines: 17 Approved: bug-bash@gnu.org Message-ID: References: <20200304181824.GA394387@chrisdown.name> <20200304192918.GB394387@chrisdown.name> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Trace: usenet.stanford.edu 1583350164 32271 209.51.188.17 (4 Mar 2020 19:29:24 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0Xk3+PDTcjqsEatvwwc9xak6ajnNpxoeHtktQHxXuQ0=; b=mIel15PgM0e12QiJKwrF+WJDOUvE8p3Z3NXRxp8jBhi+VO/99XlD48XutCmbz/f9bc A+NNfCp4wpZ0Q6aB5E0mtWdB1aBULaSz6PHlo2xqiQqD1ehE7QGBb2/5MfqQ5ogIyrUo /04BBR1EGXE0UhX5xSm4/J3uanNBi0sXYLlZg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0Xk3+PDTcjqsEatvwwc9xak6ajnNpxoeHtktQHxXuQ0=; b=qVxoLS+LYYhfCpqdruNoWycIV5wSJACeVrNczpQC2JYZWW9Z/arnUReFvHEGUqRD/i WrFd03652gt2zRy/DYGCJqFKccU+MzBFetHinzLQm1O+gZ22cUPROxvyvI2FseMyPGtB dRp9halvfnIKuRuu0rBHePiVV+l2JQqFLbeZre01j5n68FTMuxpgVGO8fW1RAeHO/5fb qfIKsZpPQRmhs+ywGvvYf1S6ujSCy2MYpcqA3WVQnAwm3YWDwI4Weelb2Fev7Iwi30lN TcnBBjTnBVvNR8clD73id4PQ2Uuujj+xWon3+jOBlyPG3p8AwUyrX87atlYk/yDMtcpr 0apg== X-Gm-Message-State: ANhLgQ2aYiFd1FPITV3uqTDqb/vwLx2TjESJ/q3P6lmCHtNiiMbuNveo NSKj7jkTWPsPWz2mF+5yWj39n0yVz0TJvw== X-Google-Smtp-Source: ADFU+vv2ZNJOqgyK0036yDguwDRo2B7UarGW+h4f8GgT5nrgJ8v9aSJoiQ9ODoKKtoJkSNd3wjVqmA== X-Received: by 2002:adf:f686:: with SMTP id v6mr5334293wrp.176.1583350158999; Wed, 04 Mar 2020 11:29:18 -0800 (PST) Content-Disposition: inline In-Reply-To: <20200304181824.GA394387@chrisdown.name> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20200304192918.GB394387@chrisdown.name> X-Mailman-Original-References: <20200304181824.GA394387@chrisdown.name> Xref: csiph.com gnu.bash.bug:15988 Ah, it's been a while since I did this and I forgot about the granularity of the devel branch :-) There it bisects to 73a146bec7f75da9f78f6d54329c980b75a2318d ("commit bash-20130215 snapshot"). I'm pretty sure it's related to this change to add the signal handler inside initialize_shell_signals, which sets a new handler if SIGTERM isn't SIG_HARD_IGNORE. If I read the code correctly, in that case we will resume due to SA_RESTART, but bubbling up readline() will now return 0, which will be passed to yy_readline_get(), which returns EOF if current_readline_line is 0, so the shell closes. I'm not quite sure how best to handle this, maybe setting SIG_IGN as the default signal handler for interactive shells if there's nothing to inherit? This is one of those cases where SA_RESTART doesn't quite mimic SIG_IGN...