From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6657829413861720064 X-Received: by 2002:a5d:624e:: with SMTP id m14mr450863wrv.3.1552386173257; Tue, 12 Mar 2019 03:22:53 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:2d06:: with SMTP id t6ls289166wmt.10.gmail; Tue, 12 Mar 2019 03:22:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7USTTzdf0mRTCT/aCwaj86CoOChfD6Dkrt2WwpM9Js73rf+W7YMGXyU/LioOEIwysgk7d X-Received: by 2002:a1c:1f90:: with SMTP id f138mr189147wmf.3.1552386172834; Tue, 12 Mar 2019 03:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552386172; cv=none; d=google.com; s=arc-20160816; b=VDD+x6WNpXneNposBwoAb3ZoXx4yQ4jghkr/r7WNVATB1szwX0h2M25NeG/8NclXfS sR+LDrym9eYAI+3q1lMmI69D154ZXLquNrjnbM5mViEKK9cN6AYWjzmo3QdFhrZ8W5JT jUjiUel5/5buJToleUlwufB8xP/ZWjQYG7Q3lD0AdiRqCLKmezeHIUkL8DxA8KGrTImI EGyric2OSAQY6T9ICbg7jffEI7i0lmrw0iOXD9aKTELbWWYLt8Z5MnSVm+SrPZDX4XOT UANnfEwVJCyJKE+gyu7U03wIEEAKjocpw/76D7HiHFAq8ax1dnbXp4BFNb1OG7ogqluw YpdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject; bh=o2vJKV0xNdu8LcKznB5K1szfY4Lyjh8x1/kllT2wYLU=; b=L4kswUUljNITVQT/2ZjMu8DDKbgNqzCwZF8pq8BjL8LuJVWxCuMOFseh0oqRlXJN5w CJAD3LZIx25fAx0jPcz/3m8P0eHQoPhOdEzUHRKJDXtq6KZGkfRgt8Raeei4CyjIPgC/ v24W2CnAVX6BxjsIXwSyw0Vq842onAxcugG0N6z/eqGlRw0uKb7WhpuVDngKjJ/H6eYW KdUqn/hUyxuGVj8Jf82SHeE8rKDXLrCAsKYT8vSSlbL7gxdZwSgMHbJjgiipbCgVKFQ2 7tdKCMsYTFL7TRDV37PYK+DdjYvKzoKPGl131iYPONvAtoZyHevoCV1l0yaEifKXnhgu dQxg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id v189si60405wma.2.2019.03.12.03.22.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 03:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.14 as permitted sender) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id x2CAMpSh008033 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Mar 2019 11:22:51 +0100 Received: from [139.25.69.232] (linux-ses-ext02.ppmd.siemens.net [139.25.69.232]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x2CAMprT011670; Tue, 12 Mar 2019 11:22:51 +0100 Subject: Re: [PATCH v2] meta: refactored flock usage To: Jan Kiszka , Claudius Heine , isar-users@googlegroups.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> <155215849283.17890.16013197651850956589@ardipi> <27326b09-17cf-de2d-a9fd-73b48198398f@siemens.com> From: Claudius Heine Message-ID: <0437cf65-826b-c474-dc19-003c4bde8ed8@siemens.com> Date: Tue, 12 Mar 2019 11:22:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <27326b09-17cf-de2d-a9fd-73b48198398f@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TUID: N0kmoOro/4zV 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 >>>> >>>> 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 >>>> --- >>>>    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