From owner-freebsd-rc@FreeBSD.ORG Thu Feb 16 01:10:11 2012 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32790106566C for ; Thu, 16 Feb 2012 01:10:11 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) by mx1.freebsd.org (Postfix) with ESMTP id 17AD98FC0C for ; Thu, 16 Feb 2012 01:10:11 +0000 (UTC) Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 3E730CC4E; Wed, 15 Feb 2012 17:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1329354610; bh=t9NJaGH3TJ8z/cbpNlakQxFm62WQZD5DaU2u+RJwiBg=; h=Message-ID:Date:From:Reply-To:MIME-Version:To:CC:Subject: Content-Type; b=VxQIG33KfDGVkEbj0TWyOxFJIMV0PAWPAtEmqfK7hs5j0aQ9s+R7StNYAjLnUsjJs R896c0FqVuosAknXB4ThJncMvztnoqyCA+oZ5gIG3CO350+tlHuVkjZwAHirbYuKpI nSfIrXC5OzcfAUKKT1z/AgY8F/dpMRlS6+uDYU30= Message-ID: <4F3C5771.2030202@delphij.net> Date: Wed, 15 Feb 2012 17:10:09 -0800 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: freebsd-rc@FreeBSD.org X-Enigmail-Version: 1.3.5 Content-Type: multipart/mixed; boundary="------------090601020002040109050308" Cc: d@delphij.net Subject: [PATCH FOR REVIEW] rc.subr: use stderr instead of stdout for trap handlers X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2012 01:10:11 -0000 This is a multi-part message in MIME format. --------------090601020002040109050308 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi, Currently if certain signals is received, rc.subr's trap instruction would inject output to standard output. This could be a problem if the script uses standard output for other purposes, e.g. generating a configuration file, etc. The proposed change redirects these information to standard error. Objections? Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iQEcBAEBCAAGBQJPPFdxAAoJEG80Jeu8UPuzyksH/jZH6o5C3jBSarSSElKyU42A k1Wrz7GUdp36cQBIGHw0dZsEOZmMS5r6IghztLPZwO4H+1yJEae4tvkUJK2V+6t5 yBptnyzYbtAr0ns4/ntnfNJgk8NyQER4F0U5txzQgIAHhrhNPSJUr5assziU1AaN VjOpKyysBcd5btLwLfLwVwcZrwListL8YdN1CrRN2LAHY+Y9dFOYeqeIWp2vVA61 o7aegzN9hk2zr4byuoA+cyyqqWCmw4xcSEPYB3nXU3GPwGsCpp0vlXtjUIBGeGnJ +ooI+MfBVyVxnR3PJR4hleq2BiBEYtGzYt2aXd9lHGMBA/ZJL1m3t7GpvwIfCDA= =Vmmg -----END PGP SIGNATURE----- --------------090601020002040109050308 Content-Type: text/plain; name="rc.subr.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="rc.subr.diff" Index: etc/rc.subr =================================================================== --- etc/rc.subr (revision 231173) +++ etc/rc.subr (working copy) @@ -978,9 +978,9 @@ if [ -n "$rc_fast_and_loose" ]; then set $_arg; . $_file else - ( trap "echo Script $_file interrupted; kill -QUIT $$" 3 - trap "echo Script $_file interrupted; exit 1" 2 - trap "echo Script $_file running" 29 + ( trap "echo Script $_file interrupted >&2 ; kill -QUIT $$" 3 + trap "echo Script $_file interrupted >&2 ; exit 1" 2 + trap "echo Script $_file running >&2" 29 set $_arg; . $_file ) fi fi --------------090601020002040109050308--