public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Hombourger, Cedric" <Cedric_Hombourger@mentor.com>
To: Henning Schild <henning.schild@siemens.com>
Cc: "isar-users@googlegroups.com" <isar-users@googlegroups.com>
Subject: RE: [PATCH] isar-bootstrap: preserve environment in sudo'ed debootstrap call
Date: Thu, 13 Sep 2018 12:42:27 +0000	[thread overview]
Message-ID: <e31621bea09840149e8667a403b1b0f8@svr-ies-mbx-02.mgc.mentorg.com> (raw)
In-Reply-To: <20180913143622.09597d5e@md1pvb1c.ad001.siemens.net>

Hi Henning,

I was also curious about this export_proxies() thing and looked at its implementation 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 that puts http_proxy and friends into the environment. When we execute
the shell block passed to sudo, the Python code will evidently have no effect. 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 block. That's a good catch. Will update my patch

Cedric

-----Original Message-----
From: Henning Schild [mailto:henning.schild@siemens.com] 
Sent: Thursday, September 13, 2018 2:36 PM
To: Hombourger, Cedric <Cedric_Hombourger@mentor.com>
Cc: isar-users@googlegroups.com
Subject: Re: [PATCH] isar-bootstrap: preserve environment in sudo'ed debootstrap call

Am Thu, 13 Sep 2018 14:20:58 +0200
schrieb Cedric Hombourger <Cedric_Hombourger@mentor.com>:

> Make bitbake add proxy environment variables and preserve them when 
> calling debootstrap under sudo. This is required to get user-defined 
> proxies used while bootstraping Isar.
> 
> Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
> ---
>  meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index 
> 4010307..a936e7f 100644 --- 
> a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++ 
> 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="${@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 @@ 
> isar_bootstrap() {
>                 umount -l "${ROOTFSDIR}/proc" || true
>                 rm -rf "${ROOTFSDIR}"
>              fi
> -            E="${@bb.utils.export_proxies(d)}"
>              if [ ${IS_HOST} ]; then
>                  ${DEBOOTSTRAP} --verbose \
>                                 --variant=minbase \

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 the flock-block twice?

If there is a difference in doing the export_proxies before "sudo flock", please explain why it should be outside. And remove the second inner export_proxies if possible.

Henning

  reply	other threads:[~2018-09-13 12:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-13 12:20 Cedric Hombourger
2018-09-13 12:36 ` Henning Schild
2018-09-13 12:42   ` Hombourger, Cedric [this message]
2018-09-13 12:46     ` [PATCH v2] " Cedric Hombourger
2018-09-13 13:09       ` Jan Kiszka
2018-09-13 13:15         ` Hombourger, Cedric
2018-09-13 13:37           ` Henning Schild
2018-09-13 16:17             ` chombourger
2018-09-25 10:05               ` chombourger
2018-09-25 17:39       ` 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=e31621bea09840149e8667a403b1b0f8@svr-ies-mbx-02.mgc.mentorg.com \
    --to=cedric_hombourger@mentor.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