public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Claudius Heine <claudius.heine.ext@siemens.com>
To: Jan Kiszka <jan.kiszka@siemens.com>, Claudius Heine <ch@denx.de>,
	isar-users@googlegroups.com
Subject: Re: [PATCH v2] meta: refactored flock usage
Date: Tue, 12 Mar 2019 11:22:51 +0100	[thread overview]
Message-ID: <0437cf65-826b-c474-dc19-003c4bde8ed8@siemens.com> (raw)
In-Reply-To: <27326b09-17cf-de2d-a9fd-73b48198398f@siemens.com>

On 12/03/2019 11.20, Jan Kiszka wrote:
> On 09.03.19 20:08, Claudius Heine wrote:
>> 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 <ch@denx.de>
>>>>
>>>> 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).
>>>>
>>>> The usage of flock was changed to no longer require single or double
>>>> ticks. Instead commands are run inside a subshell.
>>>>
>>>> Signed-off-by: Claudius Heine <ch@denx.de>
>>>> ---
>>>>    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(-)
>>>>
>>>> diff --git a/meta/classes/buildchroot.bbclass 
>>>> b/meta/classes/buildchroot.bbclass
>>>> index 0d4ff4e..c017b25 100644
>>>> --- a/meta/classes/buildchroot.bbclass
>>>> +++ b/meta/classes/buildchroot.bbclass
>>>> @@ -22,7 +22,8 @@ python __anonymous() {
>>>>    MOUNT_LOCKFILE = "${BUILDCHROOT_DIR}/mount.lock"
>>>>    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() {
>>>>            # 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] = 
>>>> "${DISTRO}-${DISTRO_ARCH}"
>>>>    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=${FAKEROOTCMD}
>>>>        export BUILDDIR=${BUILDDIR}
>>>>        export MTOOLS_SKIP_CHECK=1
>>>> 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="--verbose --variant=minbase 
>>>> --include='${DISTRO_BOOTSTRAP_BASE_PACKAGES}'"
>>>> +    debootstrap_args="--verbose --variant=minbase 
>>>> --include=${DISTRO_BOOTSTRAP_BASE_PACKAGES}"
>>>
>>> Are you sure that the removal of '' is correct here as well? What 
>>> binds that
>>> package list to --include=?
>>
>> 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.
> 
> But the package list may contain spaces as well, no?

debootstrap manpage:

        --include=alpha,beta
               Comma separated list of packages which will be added to
               download  and  extract lists.


If it does, than that is AFAIK undocumented and should not be done.

Claudius

-- 
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

  reply	other threads:[~2019-03-12 10:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 12:18 [PATCH] " claudius.heine.ext
2019-02-14 12:50 ` Claudius Heine
2019-02-14 16:08 ` [PATCH v2] " claudius.heine.ext
2019-03-07 13:23   ` Claudius Heine
2019-03-08 17:38     ` Baurzhan Ismagulov
2019-03-09 19:11       ` Claudius Heine
2019-03-12 10:16       ` Andreas Reichel
2019-03-08 17:49   ` Jan Kiszka
2019-03-09 19:08     ` Claudius Heine
2019-03-12 10:20       ` Jan Kiszka
2019-03-12 10:22         ` Claudius Heine [this message]
2019-03-12 13:18   ` 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=0437cf65-826b-c474-dc19-003c4bde8ed8@siemens.com \
    --to=claudius.heine.ext@siemens.com \
    --cc=ch@denx.de \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.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