From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6600683098303627264 X-Received: by 2002:a19:c508:: with SMTP id w8-v6mr242368lfe.2.1536842554686; Thu, 13 Sep 2018 05:42:34 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a19:d752:: with SMTP id o79-v6ls470558lfg.16.gmail; Thu, 13 Sep 2018 05:42:34 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb5e30Gi1SMkeGYNAJZu1uuL4gTQS3X3E8PLzNYMqIgbYLk/UNLtgnbV1Gy4LxY64DK6l33 X-Received: by 2002:a19:5f19:: with SMTP id t25-v6mr218354lfb.15.1536842554113; Thu, 13 Sep 2018 05:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536842554; cv=none; d=google.com; s=arc-20160816; b=HaLD1fvX9usgSGK6AhaZ5GVGI3HtPQG7a+hRm0OWlruFfnG6Ri0569nuYkBwaX4cOZ shq3uyHx/fSvsYi0uDqlKG+dCdbXj4aTDpONUlUVfFEZk9iPHEjb2XG7uQXG9ZXjNTcK SrYaOxY2h3xdkmtRI9O/QcB8ghlNgpq6WDa2bMTX5bHVO9YH4CMX1AmO4FRW/JzIZVdH cMmw0gSFqpiRYV1v/JvHs5fOhw+aDVbmoveMmZSUMBqmCe2uLnZHGmYeR98ycHMR9/DZ 3yL08+ZK0uz0ucu+dNuRkLH8WA5CwrD/NvGmD4aMgwrsKtro95WXjcMbpNImDtjAXr8T slHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=TzO5a7Z7UAoTfDrVeYDUOwzPnjfbjSbVXEEnOjJYJC0=; b=N9h7mhX1qrxsmbaaGPPL10TTk8MgmWtSCwSwoWQT3lwS9JpF1hr2LvalVKkA7ZhvU+ XIewjwldjwr7JM3zhKGSWWetRxpZkludCFYCHWxewfvtNOaCVw5u9QHvuuucwU2VOvn7 ebqZXKIs2vp4Bnol6d+wMrAHuL+MWT6O29uCb6R5EGigQd0kL5zzcYV6VwU9niMu2e4o 1jbGOX8RDUCBSgc5IcZN1BKNyE2oLJpRHfj2EDTshbqYDRHYotc4vrJ56lpIL5xA7VHn 2BIRVOppN7TCKZuZh8xqkBv2FVzuDYAGr1AhJFszGlInqEwkk/kCKd2x0J4PLrZx/pZt kULg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Return-Path: Received: from relay1.mentorg.com (relay1.mentorg.com. [192.94.38.131]) by gmr-mx.google.com with ESMTPS id v16-v6si92851ljg.3.2018.09.13.05.42.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Sep 2018 05:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) client-ip=192.94.38.131; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-03.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1g0Qx5-0005P4-Db from Cedric_Hombourger@mentor.com ; Thu, 13 Sep 2018 05:42:31 -0700 Received: from svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) by SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 13 Sep 2018 13:42:27 +0100 Received: from svr-ies-mbx-02.mgc.mentorg.com ([fe80::a01f:51c9:5b6c:e0c]) by svr-ies-mbx-02.mgc.mentorg.com ([fe80::a01f:51c9:5b6c:e0c%22]) with mapi id 15.00.1320.000; Thu, 13 Sep 2018 13:42:27 +0100 From: "Hombourger, Cedric" To: Henning Schild CC: "isar-users@googlegroups.com" Subject: RE: [PATCH] isar-bootstrap: preserve environment in sudo'ed debootstrap call Thread-Topic: [PATCH] isar-bootstrap: preserve environment in sudo'ed debootstrap call Thread-Index: AQHUS1xNaTDTjgfejEG/HBG4En0L/6TuFUUAgAARC5A= Date: Thu, 13 Sep 2018 12:42:27 +0000 Message-ID: References: <1536841258-161-1-git-send-email-Cedric_Hombourger@mentor.com> <20180913143622.09597d5e@md1pvb1c.ad001.siemens.net> In-Reply-To: <20180913143622.09597d5e@md1pvb1c.ad001.siemens.net> Accept-Language: en-US, en-IE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [137.202.0.90] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-TUID: BD4Ny2JKcVIN Hi Henning, I was also curious about this export_proxies() thing and looked at its impl= ementation as I was not understanding how the E variable was being used export_proxies() expands to True if it succeeded. It is a python function t= hat puts http_proxy and friends into the environment. When we execute the shell block passed to sudo, the Python code will evidently have no effe= ct. If unsure, take a look at the generated run.do_bootstrap script. I missed the export_proxies() call we have towards the end of the sudo bloc= k. That's a good catch. Will update my patch Cedric -----Original Message----- From: Henning Schild [mailto:henning.schild@siemens.com]=20 Sent: Thursday, September 13, 2018 2:36 PM To: Hombourger, Cedric Cc: isar-users@googlegroups.com Subject: Re: [PATCH] isar-bootstrap: preserve environment in sudo'ed deboot= strap call Am Thu, 13 Sep 2018 14:20:58 +0200 schrieb Cedric Hombourger : > Make bitbake add proxy environment variables and preserve them when=20 > calling debootstrap under sudo. This is required to get user-defined=20 > proxies used while bootstraping Isar. >=20 > Signed-off-by: Cedric Hombourger > --- > meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index=20 > 4010307..a936e7f 100644 ---=20 > a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++=20 > b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -171,7 > +171,8 @@ isar_bootstrap() { esac > shift > done > - sudo flock "${ISAR_BOOTSTRAP_LOCK}" -c "\ > + E=3D"${@bb.utils.export_proxies(d)}" > + sudo -E flock "${ISAR_BOOTSTRAP_LOCK}" -c "\ > set -e > if [ ! -e "${DEPLOY_ISAR_BOOTSTRAP}" ]; then > if [ -e "${ROOTFSDIR}" ]; then @@ -179,7 +180,6 @@=20 > isar_bootstrap() { > umount -l "${ROOTFSDIR}/proc" || true > rm -rf "${ROOTFSDIR}" > fi > - E=3D"${@bb.utils.export_proxies(d)}" > if [ ${IS_HOST} ]; then > ${DEBOOTSTRAP} --verbose \ > --variant=3Dminbase \ So you are pulling that thing out of the sudo? How does that change what is= happening? One way or the other, the environment should be as expected. The other thing i was wondering, why is this export_proxies expression in t= he flock-block twice? If there is a difference in doing the export_proxies before "sudo flock", p= lease explain why it should be outside. And remove the second inner export_= proxies if possible. Henning