<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13717</bug_id>
          
          <creation_ts>2019-12-19 19:40:53 +0000</creation_ts>
          <short_desc>FieldError when trying to load Reverse runtime dependencies</short_desc>
          <delta_ts>2020-03-30 18:32:27 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Toaster</product>
          <component>toaster</component>
          <version>2.6.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.1 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ahmed Hossam">Ahmed.Hossam</reporter>
          <assigned_to name="David Reyna">david.reyna</assigned_to>
          
          
          <qa_contact name="Toaster default assignee">toaster</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>85874</commentid>
    <comment_count>0</comment_count>
    <who name="Ahmed Hossam">Ahmed.Hossam</who>
    <bug_when>2019-12-19 19:40:53 +0000</bug_when>
    <thetext>Preconditions/Environment
-------------------------
Poky branch thud
Ubuntu 18.04 LTS
command line build with toaster running

Triggering Action/Cause
-----------------------
git clone https://git.yoctoproject.org/git/poky -b thud --depth 1
cd poky/
source oe-init-build-env
# I added my common DL_DIR and SSTATE_DIR to conf/local.conf
source toaster start
bitbake core-image-minimal


Load up localhost:8000/
select the core image minimal from the command line builds
select core-image-minimal under images
select one of the included packages (For example busybox)
select the &quot;Reverse runtime dependencies&quot; tab
URL is http://localhost:8000/toastergui/build/3/package_included_reverse_dependencies/3/9196?count=25&amp;page=1&amp;orderby=package__name%3A%2B


Expectation
-----------
You should be able to see the reverse runtime dependencies

Actual Result
-------------
FieldError at /toastergui/build/3/package_included_reverse_dependencies/3/9196

Non-relational field given in select_related: &apos;name&apos;. Choices are: build, recipe, customimagepackage

Request Method: 	GET
Request URL: 	http://localhost:8000/toastergui/build/3/package_included_reverse_dependencies/3/9196?count=25&amp;page=1&amp;orderby=package__name%3A%2B
Django Version: 	1.11.8
Exception Type: 	FieldError
Exception Value: 	

Non-relational field given in select_related: &apos;name&apos;. Choices are: build, recipe, customimagepackage

Exception Location: 	/home/user/.local/lib/python3.6/site-packages/django/db/models/sql/compiler.py in get_related_selections, line 730
Python Executable: 	/usr/bin/python3
Python Version: 	3.6.9
Python Path: 	

[&apos;/ws/thud/poky/bitbake/lib&apos;,
 &apos;/ws/thud/poky/bitbake/lib/toaster&apos;,
 &apos;/usr/lib/python36.zip&apos;,
 &apos;/usr/lib/python3.6&apos;,
 &apos;/usr/lib/python3.6/lib-dynload&apos;,
 &apos;/home/user/.local/lib/python3.6/site-packages&apos;,
 &apos;/usr/local/lib/python3.6/dist-packages&apos;,
 &apos;/usr/lib/python3/dist-packages&apos;]

Server time: 	Thu, 19 Dec 2019 20:20:56 +0100

#### Log truncated (Tell me if you need the full log) #### 

/ws/thud/poky/bitbake/lib/toaster/toastergui/views.py in package_included_reverse_dependencies

1216. for o in objects:

▼ Local vars
Variable 	Value
build_id 	&apos;3&apos;
filter_string 	&apos;&apos;
mandatory_parameters 	{&apos;count&apos;: &apos;25&apos;, &apos;orderby&apos;: &apos;package__name:+&apos;, &apos;page&apos;: 1}
objects 	Error in formatting: FieldError: Non-relational field given in select_related: &apos;name&apos;. Choices are: build, recipe, customimagepackage
orderby 	&apos;package__name:+&apos;
ordering_string 	&apos;package__name:+&apos;
package 	&lt;Package: Package object&gt;
package_id 	&apos;9196&apos;
pagesize 	&apos;25&apos;
queryset 	Error in formatting: FieldError: Non-relational field given in select_related: &apos;name&apos;. Choices are: build, recipe, customimagepackage
request 	&lt;WSGIRequest: GET &apos;/toastergui/build/3/package_included_reverse_dependencies/3/9196?count=25&amp;page=1&amp;orderby=package__name%3A%2B&apos;&gt;
retval 	None
search_term 	&apos;&apos;
target 	&lt;Target: Target object&gt;
target_id 	&apos;3&apos;
template 	&apos;package_included_reverse_dependencies.html&apos;

#### Log truncated (Tell me if you need the full log) #### 

Reproducibility
---------------
always (5/5)

Currently used workaround
-------------------------
# This workaround is from 10 minutes of googling with no knowledge about this API
# After the workaround is applied the command &quot;source toaster stop&quot; then &quot;source toaster start&quot; need to be executed
$ git diff
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index c712b06..5c1ce70 100644
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -1206,7 +1206,7 @@ def package_included_reverse_dependencies(request, build_id, target_id, package_
         return _redirect_parameters( &apos;package_included_reverse_dependencies&apos;, request.GET, mandatory_parameters, build_id = build_id, target_id = target_id, package_id = package_id)
     (filter_string, search_term, ordering_string) = _search_tuple(request, Package_File)
 
-    queryset = Package_Dependency.objects.select_related(&apos;depends_on__name&apos;, &apos;depends_on__size&apos;).filter(depends_on=package_id, target_id=target_id, dep_type=Package_Dependency.TYPE_TRDEPENDS)
+    queryset = Package_Dependency.objects.select_related(&apos;depends_on&apos;).filter(depends_on=package_id, target_id=target_id, dep_type=Package_Dependency.TYPE_TRDEPENDS)
     objects = _get_queryset(Package_Dependency, queryset, filter_string, search_term, ordering_string, &apos;package__name&apos;)
 
     package = Package.objects.get(pk=package_id)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85878</commentid>
    <comment_count>1</comment_count>
    <who name="Ahmed Hossam">Ahmed.Hossam</who>
    <bug_when>2019-12-19 22:00:11 +0000</bug_when>
    <thetext>Reproduced on master with the same steps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85879</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmed Hossam">Ahmed.Hossam</who>
    <bug_when>2019-12-19 23:08:42 +0000</bug_when>
    <thetext>Reproduced on Thud with project created from the Toaster GUI</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85884</commentid>
    <comment_count>3</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2019-12-20 00:43:25 +0000</bug_when>
    <thetext>Interesting. You found a bug and provided a potential fix, thank you!

I will take a look. I am curious why I have not hit this error path.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85885</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmed Hossam">Ahmed.Hossam</who>
    <bug_when>2019-12-20 00:59:44 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Interesting. You found a bug and provided a potential fix, thank you!
&gt; 
&gt; I will take a look. I am curious why I have not hit this error path.

I know this worked before in a previous release (Krogoth or Rocko) as I used Toaster for &quot;Why is this file/package in my image?&quot; investigations, not really sure when it broke.

Feel free to use the workaround/fix but keep in mind I had no idea what I was doing, just trying solutions to the error from stackoverflow until one of them worked, I don&apos;t know how removing that parameter and renaming the other &quot;fixed&quot; the issue.


Tell me if you need me to run any tests or trials, I will gladly do so.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86870</commentid>
    <comment_count>5</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2020-03-30 18:32:27 +0000</bug_when>
    <thetext>commit 4f959dff769f37d745daf705dd169704656e0ba3</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>