HomeFreeBSD

Fix using more than one files in UID_FILES and GID_FILES.

Description

Fix using more than one files in UID_FILES and GID_FILES.

Repeat after me: If you change IFS, it will break something unexpected.

The problem is that we use IFS to change read's field separator. This
has the side effect of changing how sh(1) splits all string, including
in command parsing functions.

In this case, unless quoted, the strings are always splitted using IFS.
So changing IFS will change how these strings are splitted, and you end
up having a headache. For example:

$ GID_FILES="foo bar"
$ set -x
$ echo $GID_FILES
+ echo foo bar
foo bar

$ IFS=:
$ GID_FILES="foo bar"
$ set -x
$ echo $GID_FILES
+ echo 'foo bar'
foo bar

In the first case, it runs echo with two arguments, first is foo, second is bar.
In the second case, it runs echo with one argument, 'foo bar'.

To fix this, restrict the time during which IFS changes to only one
command, set, and use positional parameters to extract values.

Reported by: feld
Sponsored by: Absolight
Differential Revision: https://reviews.freebsd.org/D11632