From owner-svn-src-head@FreeBSD.ORG Thu Nov 7 10:20:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 74D934DB; Thu, 7 Nov 2013 10:20:20 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 495E72EF3; Thu, 7 Nov 2013 10:20:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA7AKKSY027928; Thu, 7 Nov 2013 10:20:20 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA7AKKnt027927; Thu, 7 Nov 2013 10:20:20 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201311071020.rA7AKKnt027927@svn.freebsd.org> From: Devin Teske Date: Thu, 7 Nov 2013 10:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r257782 - head/usr.sbin/bsdconfig/share X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2013 10:20:20 -0000 Author: dteske Date: Thu Nov 7 10:20:19 2013 New Revision: 257782 URL: http://svnweb.freebsd.org/changeset/base/257782 Log: Add global DEBUG_INITIALIZE_FILE environment variable for controlling whether the debugFile is truncated upon initialization (useful for when children implicitly re-initialize debugging and you want children to append to your existing debugFile). Modified: head/usr.sbin/bsdconfig/share/common.subr Modified: head/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/common.subr Thu Nov 7 10:14:40 2013 (r257781) +++ head/usr.sbin/bsdconfig/share/common.subr Thu Nov 7 10:20:19 2013 (r257782) @@ -68,6 +68,14 @@ export UNAME_R="$(uname -r)" # Release L : ${DEBUG_SELF_INITIALIZE=1} # +# Default behavior of f_debug_init() is to truncate $debugFile (set to NULL to +# disable truncating the debug file when initializing). To get child processes +# to append to the same log file, export this variarable (with a NULL value) +# and also export debugFile with the desired value. +# +: ${DEBUG_INITIALIZE_FILE=1} + +# # Define standard optstring arguments that should be supported by all programs # using this include (unless DEBUG_SELF_INITIALIZE is set to NULL to prevent # f_debug_init() from autamatically processing "$@" for the below arguments): @@ -164,13 +172,13 @@ f_debug_init() [ "$debugFile" ] && export debugFile # - # Truncate the debug file upon. Note that we will trim a leading plus - # (`+') from the value of debugFile to support persistant meaning that - # f_dprintf() should print both to standard output and $debugFile - # (minus the leading plus, of course). + # Truncate debug file unless requested otherwise. Note that we will + # trim a leading plus (`+') from the value of debugFile to support + # persistant meaning that f_dprintf() should print both to standard + # output and $debugFile (minus the leading plus, of course). # local _debug_file="${debugFile#+}" - if [ "$_debug_file" ]; then + if [ "$_debug_file" -a "$DEBUG_INITIALIZE_FILE" ]; then if ( umask 022 && :> "$_debug_file" ); then f_dprintf "Successfully initialized debugFile \`%s'" \ "$_debug_file"