Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Stephane Chazelas Newsgroups: gnu.bash.bug Subject: Re: SIGINT handling Date: Mon, 21 Sep 2015 22:24:03 +0100 Lines: 43 Approved: bug-bash@gnu.org Message-ID: References: <20150918151439.GA16455@chaz.gmail.com> <20150919203628.GA27872@chaz.gmail.com> <20150921094807.GA6229@chaz.gmail.com> <56005BC4.1070906@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1442870652 4453 208.118.235.17 (21 Sep 2015 21:24:12 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash , Jilles Tjoelker To: Chet Ramey Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=3nd4dajG0a93Tr44aIjpAn6mWJQ/3TNc9mgS3CLEHbs=; b=JjlBGDvg54xVGGaUE7sCy5PkaZohs41dtQ5WMYQYuKRBBnk3dnT8YWMEQby7NCxH1Q VH6Fb+VicDAMaS9+zFIjmpApdygdzuiEr2W1AJ+pwAgNELsZQ96ngENCClxbImwirnkD 5gpuYvBPHqNczm+2fIgm65bS2kzUIFjfnnFskDhiSaQOThknc+iPSW+1jKMqFtqfBcMR zySpPIHzBsjVnNBb7Vv3BXqVc4yo50QMBHeS13KMKe/YclAr/dtRtZzEVqNGH2VDhsIK A8KFU7MgAs4qoWTwI75nwgWz7x/06XFqDyB31rTu25rf6oCGrCgraRXr91bl/NAQSZH0 D/EA== X-Received: by 10.180.186.195 with SMTP id fm3mr16326235wic.1.1442870644580; Mon, 21 Sep 2015 14:24:04 -0700 (PDT) Content-Disposition: inline In-Reply-To: <56005BC4.1070906@case.edu> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::232 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11530 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 > > control themselves instead (like vi's :! should create a process > > group and make that the foreground process group of the > > terminal so pressing ^C in sh -c vi, :!sleep 10, only sends the > > SIGINT to sleep)? > > The classic example is emacs remapping the terminal intr key to ^G > and using SIGINT as its internal abort-command signal. [...] AFAICT emacs starts a new process group (and makes it the foreground process group). UID PID PPID PGID SID C STIME TTY TIME CMD chazelas 12232 5595 12232 12232 0 15:00 pts/13 00:00:00 /bin/zsh chazelas 13609 12232 13609 12232 0 22:14 pts/13 00:00:00 sh -c emacs; echo test chazelas 13610 13609 13610 12232 0 22:14 pts/13 00:00:00 emacs >From strace: 13766 setpgid(0, 0) = 0 13766 ioctl(3, TIOCSPGRP, [13766]) = 0 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. A real-life problem though is things like: sh -c 'vi; echo hi' Where if you run :!sleep 10 and interrupt it with Ctrl-C, the "echo hi" is not run in shells that don't do WCE (and non-shell scripts and non-scripts that don't do it either). -- Stephane