public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Harald Seiler <hws@denx.de>
Cc: <isar-users@googlegroups.com>
Subject: Re: [PATCH 2/2] buildchroot: Fix not checking group
Date: Tue, 5 Feb 2019 19:34:19 +0100	[thread overview]
Message-ID: <20190205193419.105748a5@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20190205130004.15200-3-hws@denx.de>

Am Tue, 5 Feb 2019 14:00:04 +0100
schrieb Harald Seiler <hws@denx.de>:

> The previous code checked the username twice instead of the user
> AND group-names.  This patch changes the check to behave correctly
> and also adds a more comprehensive error message.
> 
> Signed-off-by: Harald Seiler <hws@denx.de>
> ---
>  meta/recipes-devtools/buildchroot/files/common.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-devtools/buildchroot/files/common.sh
> b/meta/recipes-devtools/buildchroot/files/common.sh index
> 8caa4f4..9e6adbc 100644 ---
> a/meta/recipes-devtools/buildchroot/files/common.sh +++
> b/meta/recipes-devtools/buildchroot/files/common.sh @@ -8,7 +8,12 @@
> set -e printenv | grep -q BB_VERBOSE_LOGS && set -x
>  
>  # assert we are either "root:root" or "builder:builder"
> -[ $( id -un ) = "builder" -a $( id -un ) = "builder" ] || [ $( id
> -un ) = "root" -a $( id -un ) = "root" ] +if ([ "$(id -un)" !=
> "builder" ] || [ "$(id -gn)" != "builder" ]) &&

Good catch! Sometimes you just have to double check ... ;)

Henning

> +   ([ "$(id -un)" != "root"    ] || [ "$(id -gn)" != "root"    ]);
> then
> +    echo "This script can only be run as root:root or
> builder:builder!" >&2
> +    echo "(Currently running as $(id -un)($(id -u)):$(id -gn)($(id
> -g)))" >&2
> +    exit 1
> +fi
>  
>  # Create human-readable names
>  target_arch=$2


  reply	other threads:[~2019-02-05 18:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05 13:00 [PATCH 0/2] Fix shell-scripts Harald Seiler
2019-02-05 13:00 ` [PATCH 1/2] Fix all shell-script expansions Harald Seiler
2019-02-06  7:49   ` Claudius Heine
2019-02-06  9:27     ` Harald Seiler
2019-02-06 10:08       ` Claudius Heine
2019-02-05 13:00 ` [PATCH 2/2] buildchroot: Fix not checking group Harald Seiler
2019-02-05 18:34   ` Henning Schild [this message]
2019-02-06 10:09 ` [PATCH 0/2] Fix shell-scripts 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=20190205193419.105748a5@md1za8fc.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=hws@denx.de \
    --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