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.
This commit is contained in:
Kyle Evans 2018-06-26 04:02:25 +00:00
parent 4edfa9085a
commit 6ffdd5ef2f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335653
2 changed files with 11 additions and 7 deletions

View File

@ -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

View File

@ -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;
}