From f35ff6a6884aab53eec2c00431fd2fca880c3928 Mon Sep 17 00:00:00 2001 From: ajacoutot <> Date: Thu, 31 Jul 2014 14:57:41 +0000 Subject: [PATCH] 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@ --- src/etc/rc.d/rc.subr | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/etc/rc.d/rc.subr b/src/etc/rc.d/rc.subr index ba002483..5f37d5fe 100644 --- a/src/etc/rc.d/rc.subr +++ b/src/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