<?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>8037</bug_id>
          
          <creation_ts>2015-07-21 09:34:25 +0000</creation_ts>
          <short_desc>External link to recipe file links to non-existing page when recipe information comes from a build</short_desc>
          <delta_ts>2016-08-24 10:02:41 +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>1.8</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>2.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Belen Barros Pena">belen.barros.pena</reporter>
          <assigned_to name="David Reyna">david.reyna</assigned_to>
          <cc>alexandru.damian</cc>
    
    <cc>belen.barros.pena</cc>
    
    <cc>cristiana.voicu</cc>
    
    <cc>jessica.zhang</cc>
          
          <qa_contact name="Libertad">libertad.gonzalez.de.la.cruz</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>52501</commentid>
    <comment_count>0</comment_count>
    <who name="Belen Barros Pena">belen.barros.pena</who>
    <bug_when>2015-07-21 09:34:25 +0000</bug_when>
    <thetext>Found on master:0f8d89ce66cfffccc9911d6c61470a585173b79d

Steps to reproduce:

1. Create a Toaster project

2. Build a recipe (e.g. busybox)

3. Once the build finishes, go to the &quot;all compatible recipes&quot; page and search for the recipe you just built (e.g. busybox). It should have a commit SHA as its revision: this indicates the information for the recipe is coming from a build, and not from the layer index

4. In the &quot;edit columns&quot; menu, tick the checkbox for the &quot;recipe file&quot; column

5. Next to the recipe file information, there is a blue icon. Click it

You will be brought to a URL like 

toastergui/project/[PROJECT_ID}/recipes/None

and you&apos;ll get a 404 error. 

You should be brought to the recipe file in the layer web repository. In the case of busybox, something like 

http://cgit.openembedded.org/cgit.cgi/openembedded-core/tree/meta/recipes-core/busybox/busybox_1.23.1.bb?h=fido</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54707</commentid>
    <comment_count>1</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2015-09-27 07:19:22 +0000</bug_when>
    <thetext>I believe that the issue happens because/when there are multiple entries for same layer name in the table &quot;orm_layer&quot;, and there is a race condition for which version of the layer a recipe attaches to which is why this defect is intermittent.

I suspect that if these multiple entries did not exist there would not be false connections.

2) Here you can explicitly see that there are multiple entries for &quot;openembedded-core&quot; (the layer for &quot;busybox&quot;) in the Toaster database. The broken URL happens when &quot;vcs_web_file_base_url&quot; is empty, and you can clearly see that one of the versions of that layer name has that problem.

sqlite&gt; select * from orm_layer where name=&quot;openembedded-core&quot;;
          vcs_web_url = 
                 name = openembedded-core
vcs_web_tree_base_url = 
vcs_web_file_base_url = 
      layer_source_id = 1
      layer_index_url = 
              up_date = 
              vcs_url = git://git.yoctoproject.org/poky
              summary = 
                up_id = 
                   id = 1
          description = 

          vcs_web_url = http://cgit.openembedded.org/cgit.cgi/openembedded-core
                 name = openembedded-core
vcs_web_tree_base_url = http://cgit.openembedded.org/cgit.cgi/openembedded-core/tree/%path%?h=%branch%
vcs_web_file_base_url = http://cgit.openembedded.org/cgit.cgi/openembedded-core/tree/%path%?h=%branch%
      layer_source_id = 2
      layer_index_url = 
              up_date = 2014-08-12 00:08:00
              vcs_url = git://git.openembedded.org/openembedded-core
              summary = Core metadata
                up_id = 1
                   id = 4
          description = OpenEmbedded-Core is a layer containing the core metadata for current versions of OpenEmbedded. It is distro-less (can build a functional image with DISTRO = &quot;&quot;) and contains only emulated machine support.
sqlite&gt; 

3) I believe that it is a race condition which instance of the layer name a recipe will attach to.

If you for example you search on &quot;alsa&quot; you can see that for the recipes that use the &quot;openembedded-core&quot; layer, three succeed (alsa-plugins, alsa-tools, alsa-utils-scripts) and four fail (alsa-state, alsa-lib, alsa-lib-native, alsa-utils), at least in my database.

- David</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54708</commentid>
    <comment_count>2</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2015-09-27 07:36:19 +0000</bug_when>
    <thetext>FYI, there are in fact three duplicate layer names:

sqlite&gt; .output a.txt
sqlite&gt; select name from orm_layer;
sqlite&gt; .exit
[poky]$ cat a.txt | sort | uniq -d
meta-yocto
meta-yocto-bsp
openembedded-core
[poky]$</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54709</commentid>
    <comment_count>3</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2015-09-27 07:48:12 +0000</bug_when>
    <thetext>Perhaps the &quot;race condition&quot; I mention is in fact the &quot;build&quot; action as per the defect title, where during a build the recipe gets reattached to the layer, but the bad layer entry wins.

NOTE: I will also mention as an aside that it is weird that in the compatible recipe page that every single layer has the &quot;Add Layer&quot; button present, even thought they already part of the project, certainly &quot;openembedded-core&quot; is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59614</commentid>
    <comment_count>4</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2016-03-02 06:09:09 +0000</bug_when>
    <thetext>1) I can confirm that this is still a problem in Toaster-2.1 as of March 1 2016.

2) I observe that this only seems to be related to compatible recipes from &quot;openembedded-core&quot;, even the ones that successfully build (My test was building &quot;core-minimal-base&quot;, which built &quot;busybox-1.24.1-r0&quot;).

This does not seem to affect any other layer, included/built (I tested meta-ros) or not.

3) This does not seem to be caused by the previous theory of duplicate layer entries in the database. I tested the newest database and found that the there is now one entry for &quot;openembedded-core&quot;.

There are still duplicated layer entries for &quot;meta-poky&quot; and &quot;meta-yocto-bsp&quot;, but &quot;meta-poky&quot; has no recipes, and the single &quot;meta-yocto-bsp&quot; recipe &quot;gma500-gfx-check&quot; does not have this problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65174</commentid>
    <comment_count>5</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2016-08-14 08:43:16 +0000</bug_when>
    <thetext>The reason the link is failing is because in the respective layer&apos;s table the &quot;vcs_web_file_base_url&quot; is not defined. 

The the affect layers, the &quot;vcs_web_url&quot; and &quot;vcs_web_tree_base_url&quot; are also not defined. 

These are the layers that have this deficit:
  Layer#: Name
  1     : openembedded-core 
  2     : meta-poky 
  3     : meta-yocto-bsp 
  152   : meta-tizen
  167   : meta-spec (has only &quot;vcs_web_url&quot;)
  206   : meta-phytec

When this value in the database is manually set (e.g. &quot;http://cgit.openembedded.org/openembedded-core/plain/&quot; for the in &quot;openembedded-core&quot; layer) then the correct recipe files links appear.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65175</commentid>
    <comment_count>6</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2016-08-14 09:15:31 +0000</bug_when>
    <thetext>The recipe links from layers &quot;meta-yocto-bsp&quot; and &quot;meta-poky&quot; work because these layers oddly have second corrected definitions:
   Layer#: Name
   30    : meta-yocto-bsp
   216   : meta-poky

The recipe links from layer &quot;openembedded-core&quot; apparently fail because not only is it a default layer (e.g. 1..3) with incomplete handling, it did not get a second instantiation like the others to fill in the missing values. The values are indeed existing in the parent Layer Index, they are just not applied.

The other layers like &quot;meta-tizen&quot; fail because the respective Web Repo values are not defined in the parent Layer Index.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65178</commentid>
    <comment_count>7</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2016-08-15 01:21:55 +0000</bug_when>
    <thetext>1. Root Cause: It turns out that in &quot;lsupdates.py&quot;, when scanning the updating the layer table from the Layer Index, the &quot;openembedded-core&quot; layer is treated specially and unfortunately the code to update the git web ULR&apos;s was not copied into that special case code.

The fix is therefore trivial.

2. Note: it appears to me that all pre-set layers in the &quot;toaster.conf&quot; file will end up getting instantiated twice (except for the above hard-coded special case of &quot;openembedded-core&quot;), where their first is largely empty and their second entry has all of the Layer Index data. This would explain the above observations about &quot;meta-poky&quot; and &quot;meta-yocto-bsp&quot;.

There is no external issue since the second layer seems to always win and links are correctly populated (e.g. the recipes &quot;tiny-init&quot; and &quot;gma500-gfx-check&quot;), but this could be unstable and future updates of the code could reveal issues.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65478</commentid>
    <comment_count>8</comment_count>
    <who name="Belen Barros Pena">belen.barros.pena</who>
    <bug_when>2016-08-24 10:02:41 +0000</bug_when>
    <thetext>merged to master

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=40b655db22f3ba27ff38e59acb657776e18e2db2</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>