From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6610281096522235904 X-Received: by 2002:a17:906:3590:: with SMTP id o16-v6mr5285096ejb.1.1539097895751; Tue, 09 Oct 2018 08:11:35 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:906:3451:: with SMTP id d17-v6ls1048642ejb.2.gmail; Tue, 09 Oct 2018 08:11:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV617uMfj38Ykw8PnC5kAR8DCypW1dQ+8Vy8HYdPjHn6ZCvB0SNPU+4AN5DS75V3449FjsRQ/ X-Received: by 2002:a17:906:591:: with SMTP id 17-v6mr2745540ejn.10.1539097895248; Tue, 09 Oct 2018 08:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539097895; cv=none; d=google.com; s=arc-20160816; b=U4jyf00sujhEY6+y9voi8SfXLxaHNHyOHcL8mMmtEbOCqGlyDNysLHK/+wW85VBfkz pKyVB58wejOgaMkMA8v3NxteGcVlF6XL9kUlKDHfy1Sg+ncKg3us29hVIVkNFhqI049u gKf5Try9T30EtQN4RPQtuZW1v+UP0pag/tcHxW/qOKyFedlDi5+2aB/sjBxyM190ETmy mAk3/91/liwuFDew5Anlaa4KDfWyRZ/BGRgeTtD6CsRgXviyW5IyuJ6l2cMFA3ix9BCe aN3YUnxF5YHHKFn3nhl0H4Wx89ud91j7jSjpWwXVtSDW4nFy43v9L5EfBp+DI5I50HSO mk0g== 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=j7+tg2XFPn15HpR9Ax0Za3ZG0LK7PT2yZ4vLo/FHRPg=; b=iQtXTMAoVyfZiBNY5Ee0ozd1KEyj/maIrbGubJdltUDUt7AJJAulALehV/uH/VzKZD n08Vzwrg/4Qs7A6Q0yhB6m0OYsqYFqpYngyd9F7VlCt8wvdVS93IRF/D++06hN5dzMo1 CNi0qJV7Izr06vreGFnQ/hrfErWclbU6ev2fJ5Q5l9KaXXMF7DaDeOUb2l6kyjS7W6G0 m9a1w2rjhb5IoxbxQm8hg5U/F9i0Cv95jLANCRc/HzXOL5roaLusQn1yA+wVVwzu2GX9 4+k0abm0rIgy0zpAN6ElDNi/lim3ksp4eC7el/Hiw51/x9yWTx1F6NX6nMuMTpmwtgE0 aP2A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id w53-v6si1165053edc.4.2018.10.09.08.11.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 08:11:35 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@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 jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=jan.kiszka@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 w99FBYXw026270 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Oct 2018 17:11:34 +0200 Received: from [139.25.68.37] (md1q0hnc.ad001.siemens.net [139.25.68.37] (may be forged)) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id w99FBXm2021973; Tue, 9 Oct 2018 17:11:33 +0200 Subject: Re: [PATCH] dpkg-raw: Fix rebuilding recipes To: Harald Seiler , isar-users@googlegroups.com References: <23f5cd40400ecfc4074e0fb0185902fccd7bae2e.camel@denx.de> <9e705dc1-53cd-28d1-8d8d-a832fb887d16@siemens.com> <158f4ad6a1cda4cca01e820a4279c11807b281a5.camel@denx.de> <70898627-9e55-4d83-b25c-1f41cf07da51@siemens.com> <6dd2bb73-0163-5909-94a8-a344e034369b@siemens.com> <24376cec5651e690297a0f06b841380a17cd7311.camel@denx.de> From: Jan Kiszka Message-ID: Date: Tue, 9 Oct 2018 17:11:32 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <24376cec5651e690297a0f06b841380a17cd7311.camel@denx.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: 4XLSigIXK30q On 09.10.18 16:23, Harald Seiler wrote: > On Tue, 2018-10-09 at 14:31 +0200, Jan Kiszka wrote: >> On 09.10.18 14:17, [ext] Jan Kiszka wrote: >>> On 09.10.18 12:28, Harald Seiler wrote: >>>> On Tue, 2018-10-09 at 12:05 +0200, Jan Kiszka wrote: >>>>> On 09.10.18 11:06, Harald Seiler wrote: >>>>>> Rebuilding dpkg-raw packages fails because the >>>>>> DEBIAN directories' ownership is transferred to >>>>>> root in dpkg_runbuild. This commit ensures the >>>>>> ownership is reset before attempting to write >>>>>> metadata. >>>>>> >>>>>> Signed-off-by: Harald Seiler >>>>>> --- >>>>>> meta/classes/dpkg-raw.bbclass | 3 ++- >>>>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/meta/classes/dpkg-raw.bbclass b/meta/classes/dpkg-raw.bbclass >>>>>> index c848f3d..806a2d4 100644 >>>>>> --- a/meta/classes/dpkg-raw.bbclass >>>>>> +++ b/meta/classes/dpkg-raw.bbclass >>>>>> @@ -18,7 +18,8 @@ addtask install after do_unpack before do_prepare_build >>>>>> deb_package_prepare() { >>>>>> sudo rm -rf ${D}/DEBIAN >>>>>> - mkdir -p ${D}/DEBIAN >>>>>> + sudo mkdir -p ${D}/DEBIAN >>>>>> + sudo chown ${USER}:${USER} ${D}/DEBIAN >>>>> >>>>> That makes no sense to me: We remove that folder first, and then create it under >>>>> the name of the current user. These two changes are redundant in that light. >>>>> >>>>> Can you describe in more details what you did and how the error messages looked >>>>> like? I frequently rebuild dpkg-raw packages and never saw such an issue >>>>> recently. >>>> >>>> Sure, the error message is the following: >>>> mkdir: cannot create directory `[...]/image//DEBIAN`: Permission denied >>>> >>>> This makes sense, because image/ seems to somewhere get changed to be owned by >>>> root. >>>> Because of this, the unprivileged mkdir fails when rebuilding. The change I >>>> made is >>>> to run mkdir as root and then change the ownership of the created directory. >>>> I chose >>>> this solutuion because I did not want to touch the permissions of image/. >>> >>> But if image has the wrong permissions/ownership, that is what should be >>> changed. It may actually cause other problems down the road. >>> >> >> Actually, we should first of all understand what is causing this, if it is an >> Isar issue or maybe something downstream (check if your recipe doesn't do >> something special here). The dpkg-raw.bbclass itself only plays with the >> ownership of the DEBIAN folder, and it resolves that be purging it prior to the >> recreation. And if I check the Isar test case itself: >> >> # ls -ld tmp/work/debian-stretch-amd64/example-raw-0.2-r0/image/ >> drwxr-xr-x 4 builder builder 4096 Oct 6 12:08 >> tmp/work/debian-stretch-amd64/example-raw-0.2-r0/image/ >> >> Looks OK. > > Looks like it was an error in the recipes. As far as I can tell, the faulty > recipes all used some form of `sudo install` which messes up the permissions. > Removing sudo fixed the issue. Perfect! > > It would be nice if this kind of mistake would be easier to detect. Maybe by > adding a warning? That could make sense if the detection pattern is generic enough. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux