From b9efc1f9bfa815eb49e154a5b9827e52456c4391 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 26 Nov 2024 12:01:56 +0100 Subject: [PATCH] test/users: modify root's home directory in stage test Since 9071cd0abbf8db059aa34e6cc21612da244e0684 the commands in the org.osbuild.users stage are run using the osbuild.util.chroot.Chroot context manager. This includes mounting /proc into the chroot. The `usermod` command now fails with usermod: user root is currently used by process N when modifying any property of the root user that requires the user to not be logged in (like the home directory). Change the home directory of the root user in the stage test to check for this issue and catch regressions. --- test/data/stages/users/b.json | 10 ++++++++++ test/data/stages/users/b.mpp.yaml | 5 +++++ test/data/stages/users/diff.json | 8 ++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/test/data/stages/users/b.json b/test/data/stages/users/b.json index 0033c258..d3a31cd0 100644 --- a/test/data/stages/users/b.json +++ b/test/data/stages/users/b.json @@ -699,6 +699,16 @@ } } } + }, + { + "type": "org.osbuild.users", + "options": { + "users": { + "root": { + "home": "/var/roothome" + } + } + } } ] } diff --git a/test/data/stages/users/b.mpp.yaml b/test/data/stages/users/b.mpp.yaml index 3656ecaf..1e4beb27 100644 --- a/test/data/stages/users/b.mpp.yaml +++ b/test/data/stages/users/b.mpp.yaml @@ -73,3 +73,8 @@ pipelines: keys: - ssh-ed25519 11111111111111111111111111111111111111111111111111111111111111111111 onekey - ssh-ed25519 22222222222222222222222222222222222222222222222222222222222222222222 onekey + - type: org.osbuild.users + options: + users: + root: + home: /var/roothome diff --git a/test/data/stages/users/diff.json b/test/data/stages/users/diff.json index abba0120..bfd2e83d 100644 --- a/test/data/stages/users/diff.json +++ b/test/data/stages/users/diff.json @@ -32,6 +32,10 @@ "/home/test/.bash_logout", "/home/test/.bash_profile", "/home/test/.bashrc", + "/var/roothome", + "/var/roothome/.bash_logout", + "/var/roothome/.bash_profile", + "/var/roothome/.bashrc", "/var/spool/mail/bothy", "/var/spool/mail/elodie", "/var/spool/mail/multikey", @@ -69,13 +73,13 @@ "/etc/passwd": { "content": [ "sha256:7039379cb97eea23aa2e9276ebc08009d670cec2c4dd5f861b881d6f48a31b0a", - "sha256:5eafb41281ddcbadd6ff4ead6b3e89afa8040c697b828b8662d0fc9c0cad7544" + "sha256:9c0e9394aae1b6e1c5900b92b5ef4a53cf60b1e57d3bbb2e5f899f960bf63b82" ] }, "/etc/passwd-": { "content": [ "sha256:24117042025a62b47c58edf2a4de90032e6daac4d631f4d07894b61dc3b5ff1c", - "sha256:02e8a5e49bbd731b50700323f70b0a6d765e2a6e9a1892a6b3e094618f183fdf" + "sha256:5eafb41281ddcbadd6ff4ead6b3e89afa8040c697b828b8662d0fc9c0cad7544" ] }, "/etc/shadow": {