Date: Tue, 26 Jun 2018 04:02:26 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335653 - head/usr.sbin/config Message-ID: <201806260402.w5Q42QFO038510@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Tue Jun 26 04:02:25 2018 New Revision: 335653 URL: https://svnweb.freebsd.org/changeset/base/335653 Log: config(8): Flip the order of concatenation for `hints` and `env` As previously noted, kernel's processing of these means that the first appearance of a hint/variable wins. Flipping the order of concatenation means that later variables override earlier variables, as expected when one does: hints x hints y Where perhaps x is: hint.aw_sid.0.disable=1 and y is: hint.aw_sid.0.disable=0 The expectation would be that a later appearing variable would override an earlier appearing variable, such as with `device`/`nodevice`, device.hints, and other similarly structured data files. Modified: head/usr.sbin/config/config.5 head/usr.sbin/config/config.y Modified: head/usr.sbin/config/config.5 ============================================================================== --- head/usr.sbin/config/config.5 Tue Jun 26 03:56:10 2018 (r335652) +++ head/usr.sbin/config/config.5 Tue Jun 26 04:02:25 2018 (r335653) @@ -129,8 +129,9 @@ All .Ic env and .Ic envvar -directives will be processed and added to the staitc environment in the order of -appearance. +directives will be processed and added to the static environment in reversed +order of appearance so that later specified variables properly override earlier +specified variables. Note that within .Ar filename , the first appearance of a given variable will be the first one seen by the @@ -150,8 +151,9 @@ All .Ic env and .Ic envvar -directives will be processed and added to the staitc environment in the order of -appearance. +directives will be processed and added to the static environment in reversed +order of appearance so that later specified variables properly override earlier +specified variables. .\" -------- FILES -------- .Pp .It Ic files Ar filename @@ -178,7 +180,9 @@ The file must conform to the syntax specified by .Xr device.hints 5 . Multiple hints lines are allowed. -The resulting hints will be the files concatenated in the order of appearance. +The resulting hints will be the files concatenated in reverse order of +appearance so that hints in later files properly override hints in earlier +files. .\" -------- IDENT -------- .Pp .It Ic ident Ar name Modified: head/usr.sbin/config/config.y ============================================================================== --- head/usr.sbin/config/config.y Tue Jun 26 03:56:10 2018 (r335652) +++ head/usr.sbin/config/config.y Tue Jun 26 04:02:25 2018 (r335653) @@ -200,7 +200,7 @@ Config_spec: if (hint == NULL) err(EXIT_FAILURE, "calloc"); hint->hint_name = $2; - STAILQ_INSERT_TAIL(&hints, hint, hint_next); + STAILQ_INSERT_HEAD(&hints, hint, hint_next); hintmode = 1; } @@ -360,7 +360,7 @@ newenvvar(char *name, bool is_file) err(EXIT_FAILURE, "calloc"); envvar->env_str = name; envvar->env_is_file = is_file; - STAILQ_INSERT_TAIL(&envvars, envvar, envvar_next); + STAILQ_INSERT_HEAD(&envvars, envvar, envvar_next); envmode = 1; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806260402.w5Q42QFO038510>