[gnome-continuous-yocto/gnomeostree-3.28-rocko: 1818/8267] bitbake: toaster: prevent infinite loop when finding task dependencies



commit 98ef970c8e2827a6e0fc923a49fcc00af52f878c
Author: Elliot Smith <elliot smith intel com>
Date:   Fri Jul 29 12:25:46 2016 +0100

    bitbake: toaster: prevent infinite loop when finding task dependencies
    
    Toaster occasionally records a task which depends on itself.
    This causes a problem when trying to display that task if it
    is "covered" by itself, as the code does the following: for
    task A, find a task B which covers A; then, recursively
    find the task which covers B etc. If B == A, this loop becomes
    infinite and never terminates.
    
    To prevent this, add the condition that, when finding a task B
    which covers A, don't allow B == A.
    
    [YOCTO #9952]
    
    (Bitbake rev: 88c471c7e5995abb5bca62990b91650277b6c926)
    
    Signed-off-by: Elliot Smith <elliot smith intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 bitbake/lib/toaster/toastergui/views.py |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index a40ceef..3411806 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -822,11 +822,21 @@ def _find_task_dep(task_object):
 def _find_task_revdep(task_object):
     tdeps = Task_Dependency.objects.filter(depends_on=task_object).filter(task__order__gt=0)
     tdeps = tdeps.exclude(task__outcome = Task.OUTCOME_NA).select_related("task", "task__recipe", 
"task__build")
+
+    # exclude self-dependencies to prevent infinite dependency loop
+    # in generateCoveredList2()
+    tdeps = tdeps.exclude(task=task_object)
+
     return [tdep.task for tdep in tdeps]
 
 def _find_task_revdep_list(tasklist):
     tdeps = Task_Dependency.objects.filter(depends_on__in=tasklist).filter(task__order__gt=0)
     tdeps = tdeps.exclude(task__outcome=Task.OUTCOME_NA).select_related("task", "task__recipe", 
"task__build")
+
+    # exclude self-dependencies to prevent infinite dependency loop
+    # in generateCoveredList2()
+    tdeps = tdeps.exclude(task=F('depends_on'))
+
     return [tdep.task for tdep in tdeps]
 
 def _find_task_provider(task_object):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]