Path: csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail From: Stephane Chazelas Newsgroups: gnu.bash.bug Subject: Re: SIGINT handling Date: Tue, 22 Sep 2015 13:47:23 +0100 Lines: 38 Approved: bug-bash@gnu.org Message-ID: References: <20150918151439.GA16455@chaz.gmail.com> <55FDC8B4.4000505@case.edu> <20150919213101.GA4393@chaz.gmail.com> <55FE0BB8.8040500@case.edu> <20150920155219.GA8614@chaz.gmail.com> <20150920161245.GA14980@chaz.gmail.com> <20150920194542.GB14980@chaz.gmail.com> <560054CE.6000208@case.edu> <20150921210755.GC5598@chaz.gmail.com> <20150922121808.GK25574@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1442926053 1872 208.118.235.17 (22 Sep 2015 12:47:33 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash To: Greg Wooledge 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=Ml3jm0U862q5u6lVsKamWoOApNc0bvzKPjI8mLiEnGM=; b=GWPHoz6uP9ZWUUg3wM/cvQtj59DDTJkTKP6L4pIjJYp/82caOfog3OLPYaVOa0ndck rzNCzWMY3PhlZ1Aq4bHfNJYhOJJSmhL8yhlMgcaki16DZXtqY1iNqWOSaM9ta8FRwDrT RSL3guIkRuxE2vF7CwGX8ns47x5D+gSLmKWqOmiNd+Aztxcx4QOwKTeC2VS+ziKSQJ2a jFsyoVeaedWNo00b4J3blQOZXZvJPwonXKB1FUMncDa92DjVE3Ihv7HiZXKBeQqcFcCm DmsXYKOkzKHdefYKCt/0g0qlJNU34SHMcbdRZ5SIBJsl2FNV1pWi1U2DaXnyPbpdZZrn H8yA== X-Received: by 10.194.112.104 with SMTP id ip8mr29509527wjb.131.1442926045057; Tue, 22 Sep 2015 05:47:25 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20150922121808.GK25574@eeg.ccf.org> 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::231 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:11535 2015-09-22 08:18:08 -0400, Greg Wooledge: [...] > You might already have been aware of this; I'm not sure. But in any case, > it makes a tremendous different what "cmd" is in your example. You > can't generalize it. Hi Greg, Yes, this whole thread is about the behaviour of uninteractive bash with commands that call exit() upon SIGINT. It was initially a follow-up on https://unix.stackexchange.com/questions/230421/unable-to-stop-a-bash-script-with-ctrlc/230568#230568 which was about ping specifically. It's true that with shells implementing WCE, the behaviour of ping is unfortunate, but I don't think we can say that ping is to blame, more WCE. ping cannot exit other than on error or when killed. It seems reasonable for it to exit (after printing the statistics) if there was no error upon CTRL-C. Note that the iputils version does a exit(!nreceived || (deadline && nreceived < npackets)); It it returning information to the caller which it couldn't do if it killed itself. That allows system("ping something") for instance to make use of the return status (system(3) ignores SIGINT in the parent). The WCE behaviour is cause for a number of bugs like that so I'm not sure it's such a great idea. -- Stephane