Re: SIGINT handling

2015-09-21 Thread Stephane Chazelas
2015-09-22 07:41:09 +0100, Stephane Chazelas: [...] > I wonder how FreeBSD sh addresses that. > > BTW, ksh93 has the problem (the 2011 one) as well as in: > > ksh93 -c 'while :; do /bin/true; done' > > Sometimes is not interrupted by the first ^C. (same with bash > with my patch applied). [...]

Re: SIGINT handling

2015-09-21 Thread Stephane Chazelas
2015-09-21 22:07:55 +0100, Stephane Chazelas: [...] > Can you please clarify why the check for EINTR was needed? > > What do you suggest we do to fix that issue? [...] > The thing is that thread was about the opposite problem at the > other end of the spectrum so we need to find the right way to d

Re: SIGINT handling

2015-09-21 Thread Stephane Chazelas
2015-09-21 22:24:03 +0100, Stephane Chazelas: [...] > If it didn't, we could not use it in scripts of shells that > don't do WCE *but also in non-shell scripts* (perl, python, > ruby...) or non-scripts. [...] For completeness perl's and python's system() like system(3) ignore SIGINT, so it's a WU

Re: SIGINT handling

2015-09-21 Thread Stephane Chazelas
2015-09-21 15:34:28 -0400, Chet Ramey: > On 9/21/15 5:48 AM, Stephane Chazelas wrote: > > > I'm not sure I prefer that WCE approach over WUE. Wouldn't it be > > preferable that applications that intercept SIGINT/QUIT/TSTP for > > anything other than clean-up before exit/suspend implement job > > c

Re: SIGINT handling

2015-09-21 Thread Stephane Chazelas
2015-09-21 15:04:46 -0400, Chet Ramey: > On 9/20/15 3:45 PM, Stephane Chazelas wrote: > > 2015-09-20 17:12:45 +0100, Stephane Chazelas: > > [...] > >> I thought the termsig_handler was being invoked upon SIGINT as > >> the SIGINT handler, but it is being called explicitely by > >> set_job_status_an

Re: SIGINT handling

2015-09-21 Thread Chet Ramey
On 9/21/15 5:48 AM, Stephane Chazelas wrote: > I'm not sure I prefer that WCE approach over WUE. Wouldn't it be > preferable that applications that intercept SIGINT/QUIT/TSTP for > anything other than clean-up before exit/suspend implement job > control themselves instead (like vi's :! should crea

Re: SIGINT handling

2015-09-21 Thread Chet Ramey
On 9/20/15 3:45 PM, Stephane Chazelas wrote: > 2015-09-20 17:12:45 +0100, Stephane Chazelas: > [...] >> I thought the termsig_handler was being invoked upon SIGINT as >> the SIGINT handler, but it is being called explicitely by >> set_job_status_and_cleanup so the problem is elsewhere. >> >> child_

Re: SIGINT handling

2015-09-21 Thread Jilles Tjoelker
On Mon, Sep 21, 2015 at 10:48:07AM +0100, Stephane Chazelas wrote: > 2015-09-19 21:36:28 +0100, Stephane Chazelas: > > 2015-09-18 16:14:39 +0100, Stephane Chazelas: > > [...] > > > In: > > > > > > bash -c 'sh -c "trap exit INT; sleep 10; :"; echo hi' > > > > > > If I press Ctrl-C, I still see "hi

Re: SIGINT handling

2015-09-21 Thread Stephane Chazelas
2015-09-21 17:35:36 +0200, Jilles Tjoelker: [...] > This kind of job control manipulation is very hard to get right in the > general case. FreeBSD's su does it, and it needed various iterations to > fix hanging processes or unexpected logouts, some of which only occur > when the application is star

Re: SIGINT handling

2015-09-21 Thread Stephane Chazelas
2015-09-21 17:35:36 +0200, Jilles Tjoelker: [...] > > One could also argue, that to be consistent, SIGTSTP and SIGQUIT > > should be treated similarly (strangely enough > > http://www.cons.org/cracauer/sigint.html doesn't mention SIGTSTP). > > Agreed for SIGQUIT, but not for SIGTSTP. For SIGTSTP,

Re: Misused term "subshell" in §3.3 of the Bash Manual

2015-09-21 Thread Stephane Chazelas
2015-09-21 08:49:42 -0400, Greg Wooledge: > On Mon, Sep 21, 2015 at 07:45:25PM +0800, ziyunfei wrote: > > "Functions may be exported so that *subshells* automatically have them > > defined with the -f option to the export builtin" > > > > Technically, a child shell process forked/execed by the cu

Re: Misused term "subshell" in §3.3 of the Bash Manual

2015-09-21 Thread Greg Wooledge
On Mon, Sep 21, 2015 at 07:45:25PM +0800, ziyunfei wrote: > "Functions may be exported so that *subshells* automatically have them > defined with the -f option to the export builtin" > > Technically, a child shell process forked/execed by the current shell is not > a real subshell, am I right?

Misused term "subshell" in §3.3 of the Bash Manual

2015-09-21 Thread ziyunfei
"Functions may be exported so that *subshells* automatically have them defined with the -f option to the export builtin" Technically, a child shell process forked/execed by the current shell is not a real subshell, am I right?

Re: SIGINT handling

2015-09-21 Thread Stephane Chazelas
2015-09-19 21:36:28 +0100, Stephane Chazelas: > 2015-09-18 16:14:39 +0100, Stephane Chazelas: > [...] > > In: > > > > bash -c 'sh -c "trap exit INT; sleep 10; :"; echo hi' > > > > If I press Ctrl-C, I still see "hi". > [...] > > Jilles provided with the explanation at > http://unix.stackexchange