From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id EF8A2E00CC0; Tue, 22 Nov 2016 09:06:54 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [74.125.82.48 listed in list.dnswl.org] Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 9AC7EE00CAE for ; Tue, 22 Nov 2016 09:06:50 -0800 (PST) Received: by mail-wm0-f48.google.com with SMTP id a197so35665541wmd.0 for ; Tue, 22 Nov 2016 09:06:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=irOhMz+0OQHy0EvViBJ1F/141VSsSTtljzmvVtoi6y8=; b=oPogP8WuhaTQVDu0WYcj/pEWOs2YWuyPcOAo5UyewdXF6cgUDqfkNsoEoyhrmJHjYY B+5RDzAh+tGgtCKnU8awzOsWG1bCHoNPwtaly2+rnZFAmE/dl5K6WoFfEXhhm4a3CMiH aVtz5JDx5IrKcX4Hbw5SwozuMeBGUNxhKvJ70KSQ+CUMmMVljK6lyfsZy1hBOapPcffU 5IKyPHyu+5+HVGwWQaxdY/93gpubg0cWHgldxDTkaDWSYWZyokCEEu9MoDDwlDjJCE6e jTflICEaRENObt6wDzTOPuS/GmByZpQ0QadnOzbG/rypV0xfs8Esx4RckQu3/kOIaXlK AcbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=irOhMz+0OQHy0EvViBJ1F/141VSsSTtljzmvVtoi6y8=; b=VpZpaIdg9IUXJuInsKhpM9dAQeBmvfZJ8k6ibwiOtWQi0g1qPO5PYr8AmbViu0XbuS yyG3dSkdcFucqqHaD2T3Iki7b/BKDYF0LK0yTwkSLjWrZaFo+JxloujJDc6TvsF9rY0+ ktHbhFIaFetucAnlBTtoWF8a7phOoHXVF5lFXyEiu7kKLhkZpFu7lQgrFsDZWu0pHLIA YSuxT0+yrju6OLqz9ODHhKj2RPmxhSVSh77F30ER9v2y048xV7DYUeiKynSvDwKKn1fl 90A3bCPLUZhvQZQV+mdrRkCyUaXTLaDEQlIdID1F8yCxuoF8QFz6IKE1A5PmLGsRg4Fq rcTA== X-Gm-Message-State: AKaTC03MtDmHcDJWr/WjKfax2Xo0wcXLq6IiV3nU7TnoK6qLoeGVfVccyRWI4ERzPgQsvzMW X-Received: by 10.28.143.68 with SMTP id r65mr3557962wmd.95.1479834409211; Tue, 22 Nov 2016 09:06:49 -0800 (PST) Received: from [192.168.0.78] (host31-54-69-88.range31-54.btcentralplus.com. [31.54.69.88]) by smtp.googlemail.com with ESMTPSA id dj5sm31846796wjb.34.2016.11.22.09.06.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 09:06:48 -0800 (PST) To: toaster@yoctoproject.org References: <5E53D14CE4667A45B9A06760DE5D13D0BF7D733B@ALA-MBA.corp.ad.wrs.com> From: Michael Wood Message-ID: Date: Tue, 22 Nov 2016 17:06:47 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <5E53D14CE4667A45B9A06760DE5D13D0BF7D733B@ALA-MBA.corp.ad.wrs.com> Subject: Re: [PATCH 1/1] toaster: protect against circular Layer dependencies X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2016 17:06:55 -0000 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 16/11/16 05:55, Reyna, David wrote: > Hi all, > > I found this issue while testing some new Wind River layers, where they were required to be included together which meant that they had an intentional circular dependency. > > I think that there are no current layers in the OE Layer Index with a circular dependency, nor can we create a custom one since the current Toaster UI does not allow that. However, these will be coming so I want to preempt that problem upstream with this patch. > > http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=dreyna%2Fcircular_dependencies_10631 > > - David > > =========== > > From fdc3e055eb2fcad098711f03d7ca1798f926e5ae Mon Sep 17 00:00:00 2001 > From: David Reyna > Date: Tue, 15 Nov 2016 21:36:25 -0800 > Subject: [PATCH] toaster: protect circular dependencies In the patch subject it's helpful to have a clue as to the module which is being affected such as "toaster: orm gen_layerdeps Protect against circular dependencies" I'll add this to the contribution guide as I really find it helpful when scanning down the git log to see what things have changed and where. > > Limit the recursion (to say 20 levels) when processing layer dependencies > so that circular dependecies do not cause infinite decent and an > out-of-memory failure. The duplicate found layers are already immediately > filtered in the code. > > [YOCTO #10630] > > Signed-off-by: David Reyna > --- > bitbake/lib/toaster/orm/models.py | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py > index 4f8510c..061d84e 100644 > --- a/bitbake/lib/toaster/orm/models.py > +++ b/bitbake/lib/toaster/orm/models.py > @@ -1478,17 +1478,21 @@ class Layer_Version(models.Model): > > def get_alldeps(self, project_id): > """Get full list of unique layer dependencies.""" > - def gen_layerdeps(lver, project): > + def gen_layerdeps(lver, project, depth): > + if depth==0: Just for future reference make sure that you have white space around the operators "if depth == 0" and not "depth==0" as this generates a warning (E225) You can check for these using a lint tool such as flake8 (most good editors have plugins for this) I'll fix this on submission upstream. No need to send another revision. > + return > for ldep in lver.dependencies.all(): > yield ldep.depends_on > # get next level of deps recursively calling gen_layerdeps > - for subdep in gen_layerdeps(ldep.depends_on, project): > + for subdep in gen_layerdeps(ldep.depends_on, project,depth-1): > yield subdep > > project = Project.objects.get(pk=project_id) > result = [] > projectlvers = [player.layercommit for player in project.projectlayer_set.all()] > - for dep in gen_layerdeps(self, project): > + # protect against infinite layer dependency loops > + maxdepth=20 > + for dep in gen_layerdeps(self, project, maxdepth): > # filter out duplicates and layers already belonging to the project > if dep not in result + projectlvers: > result.append(dep)