From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6626616999001718784 X-Received: by 2002:a17:906:3582:: with SMTP id o2-v6mr2552221ejb.13.1542968659368; Fri, 23 Nov 2018 02:24:19 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a50:ba6c:: with SMTP id 41ls3647784eds.9.gmail; Fri, 23 Nov 2018 02:24:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/WEOqyvXPQp5wWvHU5VOdPm4mjJf8Sd3UnPXpIPkxvHFxBq2iR/odMsP2Ou3YP+4FJtJKZz X-Received: by 2002:a05:6402:286:: with SMTP id l6mr68608edv.11.1542968658975; Fri, 23 Nov 2018 02:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542968658; cv=none; d=google.com; s=arc-20160816; b=g+l+uou/1IpDa2BMpP9Vsks+/dzCO8zqkvPAsvaao7IMgDo2UHlSUeCq4RFsAiuqn6 tF1bCGqsr4016E5CsynpDQesb64f0F04CJm9SY+Ds4JEUUZU4kF26u+/jL6njVc24+qR jBUFrTjBxl5NzvwOalcTM5+hUQ8Bu1988epgKCjThBEkJ1/pILwnXIh45kyQb9NE7ahU TY8CWhjpvXCWyf7j9xH18v1IzQUMGGhCZ6ooeGq3YcEE1YGi8aAk9gMW1u4S2fLpqcVr NybTUAMIeQiaIib8RBuZdzuscy417xQ3c3dwJmVXsJV8zBFY2f0KKRo7TrLmWfTdQhQx P1gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:references:cc:to :subject; bh=0VIptDZJHM+QbEZ363IUmrbzCfCrk5q0VmA/RV7pA6c=; b=hZUBZVE0y7MzA/9fOYYIn1NzcdSdOg8DfGqvspGUKbrlf7+zDEk0Q9uObe2yOpYWTC P0pUIW9qVAhKCmcnil8pnzeTfQHM2WPFmhl279Km/kAGCBhFyxW2SCQ937gB2OD4v2VM R6B9fJmNIal1/CdtUZHkyYa7C/IAtiXienE23sgG9bymEcMLon3XEGftmdjAjQmMiwyd pNKouoOIt0eiBuOcn2bGrphm7DHbagttVr2bDii16SuSiEHhA+cPWbjMV95N0/D+7/Dn 9sGWicsEO4p454JvQsu3gVgkb0S1T/LtwrTl/VnslzmuieubUUVvDFE4+V3PaQaWc861 AUrg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id h28si1332064edh.4.2018.11.23.02.24.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Nov 2018 02:24:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Received: from [192.168.50.180] (nat-ppp-217.71.235.199-satnet-spb.ru [217.71.235.199] (may be forged)) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id wANAOGti025149 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 23 Nov 2018 11:24:18 +0100 Subject: Re: [PATCH 1/2] buildchroot: Enter buildchroot with right user:group directly To: Henning Schild , isar-users@googlegroups.com Cc: Henning Schild References: <20181122093818.21909-1-henning.schild@siemens.com> From: "Maxim Yu. Osipov" Organization: ilbers GmbH Message-ID: <42b5823c-472e-9636-0ede-d0eb951ddc27@ilbers.de> Date: Fri, 23 Nov 2018 13:24:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20181122093818.21909-1-henning.schild@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: ru9SziFTsiLC On 11/22/18 12:38 PM, Henning Schild wrote: > From: Henning Schild > > Instead of using "su" use "chroot --userspec". That should also be the > pattern for other chroot users that do not need root. i.e. kernel build > and upcoming "apt-get source" fetcher. > This way we can skip all the chowning we had/have to do otherwise. Applied to the 'next' (with corrected authorship). Thanks, Maxim. > Signed-off-by: Henning Schild > --- > meta/classes/dpkg.bbclass | 2 +- > meta/recipes-devtools/buildchroot/files/build.sh | 3 +-- > 2 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass > index f74c9c9..24b9fe3 100644 > --- a/meta/classes/dpkg.bbclass > +++ b/meta/classes/dpkg.bbclass > @@ -19,5 +19,5 @@ do_install_builddeps[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" > # Build package from sources using build script > dpkg_runbuild() { > E="${@ bb.utils.export_proxies(d)}" > - sudo -E chroot ${BUILDCHROOT_DIR} /isar/build.sh ${PP}/${PPS} ${DISTRO_ARCH} > + sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} /isar/build.sh ${PP}/${PPS} ${DISTRO_ARCH} > } > diff --git a/meta/recipes-devtools/buildchroot/files/build.sh b/meta/recipes-devtools/buildchroot/files/build.sh > index f977b16..1ba394c 100644 > --- a/meta/recipes-devtools/buildchroot/files/build.sh > +++ b/meta/recipes-devtools/buildchroot/files/build.sh > @@ -14,5 +14,4 @@ for i in configure aclocal.m4 Makefile.am Makefile.in; do > fi > done > > -# Build the package as user "builder" > -su builder -c "cd $1; dpkg-buildpackage -a$target_arch -d --source-option=-I" > +dpkg-buildpackage -a$target_arch -d --source-option=-I > -- Maxim Osipov ilbers GmbH Maria-Merian-Str. 8 85521 Ottobrunn Germany +49 (151) 6517 6917 mosipov@ilbers.de http://ilbers.de/ Commercial register Munich, HRB 214197 General Manager: Baurzhan Ismagulov