From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH v2 1/3] buildchroot: Align UID and GID of builder user with caller
Date: Wed, 14 Nov 2018 09:31:09 +0100 [thread overview]
Message-ID: <60a370f9-3a7b-7333-a7d9-c49bbadfe145@siemens.com> (raw)
In-Reply-To: <20181114083249.37e0aa26@md1za8fc.ad001.siemens.net>
This fixes EPERM on rebuild and also some clean builds: We have to align
the IDs of the builder user with the user in the host environment.
Otherwise, files and directories can become unaccessible during the
build.
Fixes: be291cd991bd ("buildchroot: build debian packages as "builder" not "root"")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
Changes in v2:
- permit duplicate UID and GID inside buildchroot
meta/recipes-devtools/buildchroot/buildchroot.inc | 4 +++-
meta/recipes-devtools/buildchroot/files/configscript.sh | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.inc b/meta/recipes-devtools/buildchroot/buildchroot.inc
index 7dd909e..2c44db9 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.inc
+++ b/meta/recipes-devtools/buildchroot/buildchroot.inc
@@ -36,7 +36,9 @@ do_build() {
# Configure root filesystem
sudo install -m 755 ${WORKDIR}/configscript.sh ${BUILDCHROOT_DIR}
- sudo chroot ${BUILDCHROOT_DIR} /configscript.sh
+ USER_ID=$(id -u)
+ GROUP_ID=$(id -g)
+ sudo chroot ${BUILDCHROOT_DIR} /configscript.sh $USER_ID $GROUP_ID
sudo mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads
}
diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh
index 30660e7..25a21ef 100644
--- a/meta/recipes-devtools/buildchroot/files/configscript.sh
+++ b/meta/recipes-devtools/buildchroot/files/configscript.sh
@@ -10,6 +10,6 @@ locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
locales locales/default_environment_locale select en_US.UTF-8
END
-addgroup --quiet --system builder
-useradd --system --gid builder --no-create-home --home /home/builder --no-user-group --comment "Isar buildchroot build user" builder
+groupadd --system builder -o --gid $2
+useradd --system -o --uid $1 --gid builder --no-create-home --home /home/builder --no-user-group --comment "Isar buildchroot build user" builder
chown -R builder:builder /home/builder
--
2.16.4
next prev parent reply other threads:[~2018-11-14 8:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 15:51 [PATCH 0/3] "root" to "builder" repair series Henning Schild
2018-11-12 15:51 ` [PATCH 1/3] buildchroot: Align UID and GID of builder user with caller Henning Schild
2018-11-13 7:53 ` Jan Kiszka
2018-11-14 7:32 ` Henning Schild
2018-11-14 8:31 ` Jan Kiszka [this message]
2018-11-12 15:51 ` [PATCH 2/3] Revert "Change ownership of WORKDIR prior to unpacking" Henning Schild
2018-11-14 13:10 ` Jan Kiszka
2018-11-14 13:23 ` Jan Kiszka
2018-11-14 13:58 ` Jan Kiszka
2018-11-14 14:11 ` Henning Schild
2018-11-14 15:43 ` Henning Schild
2018-11-14 15:45 ` Jan Kiszka
2018-11-15 8:28 ` Henning Schild
2018-11-12 15:51 ` [PATCH 3/3] buildchroot: do not chown to builder:builder anymore Henning Schild
2018-11-14 12:55 ` [PATCH 0/3] "root" to "builder" repair series Maxim Yu. Osipov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60a370f9-3a7b-7333-a7d9-c49bbadfe145@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox