]> code.ossystems Code Review - openembedded-core.git/commit
rootfs-postcommands.bbclass: sort passwd entries
authorPatrick Ohly <patrick.ohly@intel.com>
Mon, 9 Jan 2017 10:09:42 +0000 (11:09 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 16 Jan 2017 18:01:52 +0000 (18:01 +0000)
commitba684f436908ac2300a00c174d5aa06b4f824367
treec87f06572f96df2c94afd31c66d97ee4185e4ce5
parent3d0060f9703ba39fbdaafcbdf91e0c319b56f7b3
rootfs-postcommands.bbclass: sort passwd entries

The /etc passwd files in a rootfs consist of the default entries from
base-passwd plus anything that gets added via package installation,
EXTRA_USERS_PARAMS and/or system sysusers.

The execution order of preinst scripts is not perfectly deterministic,
or at least unrelated changes caused it to change in a
non-deterministic way, resulting in irrelevant changes in the order of
passwd entries.

useradd-staticids.bbclass ensures that the numeric IDs don't change,
but re-ordering can still occur, which is bad for reproducible builds
and file-based update mechanisms like swupd which work best if changes
are as minimal as possible.

To achieve that, the files get sorted in a post-processing command,
enabled by default. Sorting is based primarily on the numeric IDs, so
for example, the "root" user continues to be listed first. "nobody"
now is at the end, which wasn't the case before.

The order of the entries should not matter, but in obscure cases where
it does (like having multiple entries for the same numeric ID) this
behavior can be disabled by setting SORT_PASSWD_POSTPROCESS_COMMAND to
an empty string.

Fixes: YOCTO #10520
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/rootfs-postcommands.bbclass
meta/lib/rootfspostcommands.py [new file with mode: 0644]