From: ajacoutot Date: Thu, 31 Jul 2014 14:57:41 +0000 (+0000) Subject: In debug mode, properly sort and drop duplicates so that we don't end X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f936b0a4ce7017174a6218259d20ca89d3a31793;p=openbsd In debug mode, properly sort and drop duplicates so that we don't end up with a confusing output like: multicast_host >NO< <...> multicast_host >YES< Also properly evaluate values _after_ running _rc_quirks() because these can modify flags. ok robert@ halex@ --- diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr index ba002483c4e..5f37d5fe888 100644 --- a/etc/rc.d/rc.subr +++ b/etc/rc.d/rc.subr @@ -1,4 +1,4 @@ -# $OpenBSD: rc.subr,v 1.75 2014/07/30 13:18:59 ajacoutot Exp $ +# $OpenBSD: rc.subr,v 1.76 2014/07/31 14:57:41 ajacoutot Exp $ # # Copyright (c) 2010, 2011, 2014 Antoine Jacoutot # Copyright (c) 2010, 2011 Ingo Schwarze @@ -114,7 +114,7 @@ _rc_quirks() { _rc_parse_conf() { typeset -l _key - local _l _val + local _conf _i _l _val local _rcconf="/etc/rc.conf" local _rcconf_local="/etc/rc.conf.local" set -A _allowed_keys -- \ @@ -137,12 +137,18 @@ _rc_parse_conf() { _val=${_val%%*([[:blank:]])} # remove leading and trailing quotes (backwards compat) [[ $_val == @(\"*\"|\'*\') ]] && _val=${_val#?} _val=${_val%?} - [ -n "${_RC_DEBUG}" ] && printf "%18s\t>$_val<\n" $_key eval "${_key}=\${_val}" + _conf="${_conf} ${_key}" done < $_rcfile done _rc_do _rc_quirks + + if [ -n "${_RC_DEBUG}" ]; then + for _i in ${_conf}; do + printf "%18s\t>$(eval echo '$'${_i})<\n" ${_i} + done | sort -uk 1b + fi } [ -n "${FUNCS_ONLY}" ] && return