From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6657829413861720064 X-Received: by 2002:a1c:1f90:: with SMTP id f138mr1769815wmf.3.1552158498518; Sat, 09 Mar 2019 11:08:18 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:2356:: with SMTP id j83ls7105wmj.4.gmail; Sat, 09 Mar 2019 11:08:17 -0800 (PST) X-Google-Smtp-Source: APXvYqxj3kC38KdYLy+s2hGP1Aj0r9ASQlhUon3aha9P1W1c5crklm1gX0CmJMMVQRRZezwwEq8w X-Received: by 2002:a1c:1a47:: with SMTP id a68mr1850122wma.18.1552158497928; Sat, 09 Mar 2019 11:08:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552158497; cv=none; d=google.com; s=arc-20160816; b=cqjOsYX6sHNybllXoIcYFA8CHSmeULAsPz22HyeZ4sYAilLGE6CmpmrYB38lnBERBz 5BfPQVNfYUEbLKXYt60ZgJs2zpo1JihdhqAgOJ4CX/kKljfK+Tm38wWvTim1kfsGllSV /6uT7IjKjfDb67X8CtIj1JTARI/PdckfNJi0m1Q+7pP0igXU5oDo7BZAWad+7/apYolx N6zucCSrzJnt8u0LXvL4NIsBwwJBFOxnKH1bQdb+NtSYoez85HwiGGaEIlQ76ZX1EZz2 WvFXjWFf6YPirdZ49JHBrHvWGsOnCeNGe6PN8o/JjgmjEgxGgdqAz5V8BFFOx3jr9v8d Tcwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:user-agent:message-id:from:subject:to:references:in-reply-to :content-disposition:mime-version; bh=l0Sk08jIVCzv5hFu1ZEBDmeHJBZy2SAJCqDCdyXnwAo=; b=wRg7jWJQwTb/4k7ToH8tuSsD7NSj2OvnkjruETNeMM/fRfjt88As4hxDj55AHuy8xb 7CSxH7vLJmjggZNg4IXx33+q1eK3KEz+uhlJfkp3S1tOseccrIn5NrKXsivJKsuV7LlN RG2Yz1CrVEt/3mu8bcFXaTpN0wskHGfCJF+U3hrHSFxms5m3dIMSymANRO3bbsfY4MO/ 2Q+Ak7WhwNC5tT4E3sAtwHOw1HeMjlsSTWIgReIO9HWEqtvSZJ2HRNyaX/UVNRB+g+gu c3Yfku7bUk75Hdc792H9sk2+QVallngfBiTKnLdxMrD8cOzTi41ioFiVtjuZkbG6ijnh R3IA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of ch@denx.de) smtp.mailfrom=ch@denx.de Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net. [2001:a60:0:28:0:1:25:1]) by gmr-mx.google.com with ESMTPS id o184si440024wma.0.2019.03.09.11.08.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Mar 2019 11:08:17 -0800 (PST) Received-SPF: neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of ch@denx.de) client-ip=2001:a60:0:28:0:1:25:1; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of ch@denx.de) smtp.mailfrom=ch@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 44Gv5s5088z1r0gX; Sat, 9 Mar 2019 20:08:17 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 44Gv5s4cGxz1rVx8; Sat, 9 Mar 2019 20:08:17 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id OyS6W0St-lwR; Sat, 9 Mar 2019 20:08:16 +0100 (CET) X-Auth-Info: x3kToCJuGUoHrOi82PVYXAU6Jss62t3q9KyR42OI/XE= Received: from localhost (dslb-092-075-029-133.092.075.pools.vodafone-ip.de [92.75.29.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sat, 9 Mar 2019 20:08:15 +0100 (CET) Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="===============7248875412878814005==" MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2b7ea7d6-5c27-2b86-e05a-37d21f58358f@siemens.com> References: <20190214121819.22037-1-claudius.heine.ext@siemens.com> <20190214160805.19980-1-claudius.heine.ext@siemens.com> <2b7ea7d6-5c27-2b86-e05a-37d21f58358f@siemens.com> To: "[ext] claudius.heine.ext@siemens.com" , Jan Kiszka , isar-users@googlegroups.com Subject: Re: [PATCH v2] meta: refactored flock usage From: Claudius Heine Message-ID: <155215849283.17890.16013197651850956589@ardipi> User-Agent: alot/0.8 Date: Sat, 09 Mar 2019 20:08:12 +0100 X-TUID: 4CDzDvxSoXPX --===============7248875412878814005== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Jan, Quoting Jan Kiszka (2019-03-08 18:49:48) > On 14.02.19 17:08, [ext] claudius.heine.ext@siemens.com wrote: > > From: Claudius Heine > >=20 > > Currently much care has to be taken in order to correctly escape strings > > inside flock commands. And there is also on instance where this was > > incorrectly used (isar-bootstrap.inc). > >=20 > > The usage of flock was changed to no longer require single or double > > ticks. Instead commands are run inside a subshell. > >=20 > > Signed-off-by: Claudius Heine > > --- > > meta/classes/buildchroot.bbclass | 6 ++++-- > > meta/classes/wic-img.bbclass | 6 ++++-- > > meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 10 +++++++--- > > 3 files changed, 15 insertions(+), 7 deletions(-) > >=20 > > diff --git a/meta/classes/buildchroot.bbclass b/meta/classes/buildchroo= t.bbclass > > index 0d4ff4e..c017b25 100644 > > --- a/meta/classes/buildchroot.bbclass > > +++ b/meta/classes/buildchroot.bbclass > > @@ -22,7 +22,8 @@ python __anonymous() { > > MOUNT_LOCKFILE =3D "${BUILDCHROOT_DIR}/mount.lock" > > =20 > > buildchroot_do_mounts() { > > - sudo flock ${MOUNT_LOCKFILE} -c ' \ > > + sudo -s <<'EOSUDO' > > + ( flock 9 > > set -e > > if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then > > mount --bind ${REPO_ISAR_DIR}/${DISTRO} ${BUILDCHROOT_DIR= }/isar-apt > > @@ -36,5 +37,6 @@ buildchroot_do_mounts() { > > =20 > > # Refresh /etc/resolv.conf at this chance > > cp -L /etc/resolv.conf ${BUILDCHROOT_DIR}/etc > > - ' > > + ) 9>${MOUNT_LOCKFILE} > > +EOSUDO > > } > > diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass > > index 76602d8..5367a37 100644 > > --- a/meta/classes/wic-img.bbclass > > +++ b/meta/classes/wic-img.bbclass > > @@ -87,14 +87,16 @@ do_build[stamp-extra-info] =3D "${DISTRO}-${DISTRO_= ARCH}" > > =20 > > do_wic_image() { > > buildchroot_do_mounts > > - sudo flock ${MOUNT_LOCKFILE} -c ' \ > > + sudo -s <<'EOSUDO' > > + ( flock 9 > > for dir in ${BBLAYERS} ${STAGING_DIR} ${ISARROOT}/scripts; do > > mkdir -p ${BUILDCHROOT_DIR}/$dir > > if ! mountpoint ${BUILDCHROOT_DIR}/$dir >/dev/null 2>&1; = then > > mount --bind --make-private $dir ${BUILDCHROOT_DIR}/$= dir > > fi > > done > > - ' > > + ) 9>${MOUNT_LOCKFILE} > > +EOSUDO > > export FAKEROOTCMD=3D${FAKEROOTCMD} > > export BUILDDIR=3D${BUILDDIR} > > export MTOOLS_SKIP_CHECK=3D1 > > diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta= /recipes-core/isar-bootstrap/isar-bootstrap.inc > > index 234d339..9c82184 100644 > > --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > > +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > > @@ -207,14 +207,16 @@ isar_bootstrap() { > > esac > > shift > > done > > - debootstrap_args=3D"--verbose --variant=3Dminbase --include=3D'${D= ISTRO_BOOTSTRAP_BASE_PACKAGES}'" > > + debootstrap_args=3D"--verbose --variant=3Dminbase --include=3D${DI= STRO_BOOTSTRAP_BASE_PACKAGES}" >=20 > Are you sure that the removal of '' is correct here as well? What binds t= hat=20 > package list to --include=3D? Well the package list should be ',' seperated otherwise debootstrap would not accept it. With my change it would look at "'locales'" (with ') and would not find that package, since it does not exist. Having those ' there is pretty misleading and wrong. Claudius >=20 > Jan >=20 > > if [ "${ISAR_USE_CACHED_BASE_REPO}" =3D "1" ]; then > > if [ -z "${BASE_REPO_KEY}" ] ; then > > debootstrap_args=3D"$debootstrap_args --no-check-gpg" > > fi > > fi > > E=3D"${@bb.utils.export_proxies(d)}" > > - sudo -E flock "${ISAR_BOOTSTRAP_LOCK}" -c "\ > > + export IS_HOST debootstrap_args E > > + sudo -E -s <<'EOSUDO' > > + ( flock 9 > > set -e > > if [ ! -e "${DEPLOY_ISAR_BOOTSTRAP}" ]; then > > rm -rf "${ROOTFSDIR}" > > @@ -295,7 +297,9 @@ isar_bootstrap() { > > =20 > > # Finalize debootstrap by setting the link in deploy > > ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}" > > - fi" > > + fi > > + ) 9>'${ISAR_BOOTSTRAP_LOCK}' > > +EOSUDO > > } > > =20 > > CLEANFUNCS =3D "clean_deploy" > >=20 >=20 > --=20 > Siemens AG, Corporate Technology, CT RDA IOT SES-DE > Corporate Competence Center Embedded Linux >=20 > --=20 > You received this message because you are subscribed to the Google Groups= "isar-users" group. > To unsubscribe from this group and stop receiving emails from it, send an= email to isar-users+unsubscribe@googlegroups.com. > To post to this group, send email to isar-users@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgi= d/isar-users/2b7ea7d6-5c27-2b86-e05a-37d21f58358f%40siemens.com. > For more options, visit https://groups.google.com/d/optout. -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de PGP key: 6FF2 E59F 00C6 BC28 31D8 64C1 1173 CB19 9808 B153 Keyserver: hkp://pool.sks-keyservers.net --===============7248875412878814005== MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Description: signature Content-Type: application/pgp-signature; name="signature.asc"; charset="us-ascii" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEb/LlnwDGvCgx2GTBEXPLGZgIsVMFAlyEDxYACgkQEXPLGZgI sVN0bxAAmuezbUTMeFX1PmUYwJB5t0WHmRkrRyjop0mlGchBMVlkKYb0eS/HWrbH BmmZmcYc7YrMMuHZDm/4utWWB0mLvnvZ0fCAmVH/RWMuj26lRJTpxKC2JsdHUSkK XyEoJOXH7Jx3acJjkmxioIE0EyZZ+tRqK+tOlMiFCRT3O76y8pA7iPn4X8UD9jnL poGRqu83JFr2VVRMwHaUpZTBsEKTIas2nt43WNRkxAxDILBVf5T8IVGNa163+mRw ZhIcAk9oMNbo/fV1vwNVStaQAamXLoyko/8Y1sqTMioQDSVdSVfR0ADybTDXlzvI oOJ8pS6dDGHRG14C2ixvvD5TDUsWQs5o83d3o2lajOe9SL+iXW+gbNa+AWS38rAb g1g4zxEVqhwYsz0JF/N19gskdCTpcliVDmZunhGKT7kDL7Q7vNrlzbJHW5fO+U0I 22u1fnnCUbc6FAlQiUlEOUOrX16m2KTXnYjuCfYL89nYmHcaUxQKcHQ93U2ItqxC blhvtv+zv6WeFyX67m57nm3cgCPFC3t+yBcIxi2g/ISBnTOCtHZQrdhcruPk62s7 NLkc6+a0hKyybxZCP7Oi7guO9NwxZdA83avoDiF7kJk5Iue4zPXmRqSW8q2oF2YA 5SzL7oxPhTH8BauV/Ma5Pwi++YLmGIJkHq0z1M2CpsVLDeLLjS4= =hhKy -----END PGP SIGNATURE----- --===============7248875412878814005==--