From owner-svn-src-stable-8@FreeBSD.ORG Sat Jul 31 02:12:27 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A48A51065678; Sat, 31 Jul 2010 02:12:27 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 37E488FC1D; Sat, 31 Jul 2010 02:12:26 +0000 (UTC) Received: by iwn35 with SMTP id 35so2445682iwn.13 for ; Fri, 30 Jul 2010 19:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:openpgp:content-type:content-transfer-encoding; bh=InFNHpn42qqVq8EdiuVo/dU5dfwuAqa7jcrzjHHFldU=; b=ZYBbWJ1pqHiUZiGIPeK/+LwcZ6E3aAveuoLcHCJW/eURf8Zd4cOgkmDgjYY7ZW6u0M 2iafimQenb/hqcYMQ1pEATU6lNwMK3oy0p8AHIOWH2ldqFuwD3CSdyDZdmPA/3opMFMq VWRb3edXKs0053GFQWe5uSDxWHtggwHwsSJOA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:openpgp:content-type :content-transfer-encoding; b=pW8fX79GBiiAT5Ej8debNvlXCpZ8sYRQ1AfSFbTAN9V/jSMnWc4UJ6YWIRYFAWKM1k djI3d32CqHMN/5g9twvmWa+4NnQykBXyMfRtJP3DVAsoua1b6WUrzdadomVS6sx56i5+ BzjpWKcJSz7sWEvPAm8+EimBXzmcR4ls3nrzA= Received: by 10.231.34.70 with SMTP id k6mr2808547ibd.25.1280542346552; Fri, 30 Jul 2010 19:12:26 -0700 (PDT) Received: from centel.dataix.local (adsl-99-19-46-227.dsl.klmzmi.sbcglobal.net [99.19.46.227]) by mx.google.com with ESMTPS id n20sm2516345ibe.23.2010.07.30.19.12.23 (version=SSLv3 cipher=RC4-MD5); Fri, 30 Jul 2010 19:12:24 -0700 (PDT) Sender: "J. Hellenthal" Message-ID: <4C538686.5050403@dataix.net> Date: Fri, 30 Jul 2010 22:12:22 -0400 From: jhell User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.11) Gecko/20100722 Thunderbird MIME-Version: 1.0 To: Jilles Tjoelker References: <201007291655.o6TGtR0k099119@svn.freebsd.org> <4C5212CC.2070201@dataix.net> <20100730135635.GB42845@stack.nl> In-Reply-To: <20100730135635.GB42845@stack.nl> X-Enigmail-Version: 1.0.1 OpenPGP: id=89D8547E Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, FreeBSD SVN Source All , src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r210616 - stable/8/bin/sh X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2010 02:12:27 -0000 On 07/30/2010 09:56, Jilles Tjoelker wrote: > On Thu, Jul 29, 2010 at 07:46:20PM -0400, jhell wrote: >> So what has been commited here is implicitly stating that instead of >> using ( trap 'exit 1' 2 ) in a script to catch SIGINT and exit it is now >> being done on behalf of the user with no way for them to control it ? > > No, this commit only changes something for interactive mode. It > basically tries to create similar behaviour as the lines above (which > have been in place for longer) but for the case with job control. > > The lines above do have an effect in non-interactive mode, for example: > sh -c 'ftp; echo continued' > Even if ^C has been typed in ftp(1), the shell continues. If a trap has > been set on SIGINT, the code has no effect as int_pending is not set in > that case. > >> Basically this has the same effect on a script that uses ( && ) and to >> which now have the same meaning. > >> This script should print "PRINTME" twice when ^C during the sleep. > >> #!/bin/sh >> sleep 5000; echo "PRINTME" >> echo "PRINTME" > > No, this script should print nothing. This follows from common sense > (users should be able to abort scripts unless those scripts do something > to prevent it). A more technical explanation: because job control is not > enabled, sh and sleep are in the same process group and therefore both > receive terminal signals. Because sleep exited on the SIGINT, sh should > exit on it, too. > >> Whereas this script with the old behavior would have done what is trying >> to be done now for the first line but should still print only the second >> "PRINTME" during a ^C of sleep. > >> #!/bin/sh >> sleep 5000 && echo "PRINTME" >> echo "PRINTME" > > This should not print anything either, for the same reasons. > >> And this script should not print anything when ^C is used during sleep. >> #!/bin/sh >> trap 'exit 1' 2 >> sleep 5000 ; echo "PRINTME" >> echo "PRINTME" > > Correct. > >> What is being done currently on stable/8 is incorrect... > Thank you for you explanation with these. I was confusing the way SIGINT should be handled compared to how ";" is supposed to act. I did some tests against some other shells to and to my surprise they confirmed the same behavior that we have now which is correct. Thanks again & much appreciated, -- jhell,v