<?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>14907</bug_id>
          
          <creation_ts>2022-09-01 11:34:26 +0000</creation_ts>
          <short_desc>packaging debugsrc breaks for recipes with externalsrc and debug-with-srcpkg</short_desc>
          <delta_ts>2025-07-16 13:32:05 +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>OE-Core</product>
          <component>oe-core other</component>
          <version>4.0.11</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.0.28</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ola Nilsson">ola.x.nilsson</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>ola.x.nilsson</cc>
    
    <cc>pavel</cc>
    
    <cc>peter.kjellerstedt</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>steve</cc>
          
          
          <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>93948</commentid>
    <comment_count>0</comment_count>
    <who name="Ola Nilsson">ola.x.nilsson</who>
    <bug_when>2022-09-01 11:34:26 +0000</bug_when>
    <thetext>Commit c725bdb29b2669e53ea0f9d30f9683f094c9b326 (and 195b61756bae2d0066b411eea9e14da9de3992a9 on the kirkstone branch) tries to fix packaging of debugsrc for recipes that are using externalsrc. 

Unfortunately the current code does not work for recipes where S == B.  In this case the source files will be copied directy to /usr/src/debug, which will work until there is a file name collision.  For instance two recipes with a file ${S}/main.c using externalsrc at the same time. 

I did a workaround by replacing checkbuildpath with 

def checkbuildpath(file, d):
    tmpdir = d.getVar(&apos;S&apos;)  # &lt;= Instead of TMPDIR
    with open(file) as f:
        file_content = f.read()
        if tmpdir in file_content:
            return True

    return False

It&apos;s possible that this change or similar would also solve the original problem [YOCTO #8015], but I have not tested that.

I tried to find any tests for packaging of debugsrc but had no luck.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94206</commentid>
    <comment_count>1</comment_count>
    <who name="Ola Nilsson">ola.x.nilsson</who>
    <bug_when>2022-10-20 11:42:36 +0000</bug_when>
    <thetext>This bug is not on current master.
I tried to update the Version and Target Milestone fields to reflect this, I hope I did not get it wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96661</commentid>
    <comment_count>2</comment_count>
    <who name="Pavel Zhukov">pavel</who>
    <bug_when>2023-10-07 21:55:11 +0000</bug_when>
    <thetext>Hello,

Can you please share reproducer for this bug?

I&apos;ve tried to create two recipes with main.c (simple hello world application) and externalsrc. Both recipes can be bitbake&apos;d and installed and S == B.

Here is testcase I&apos;m using:


    def test_externalsrc_s_equal_b(self):
        test_recipes = [&quot;test-externalsrc1&quot;, &quot;test-externalsrc2&quot;]
        config = &apos;INHERIT += &quot;externalsrc&quot;\n&apos;
        tmpdir = tempfile.mkdtemp(prefix=&apos;tmpextsrc&apos;)
        with open(&quot;{}/main.c&quot;.format(tmpdir), &apos;x&apos;) as main:
            main.write(&quot;&quot;&quot;
#include &lt;stdio.h&gt;
int main(){
printf(&quot;Hello world!&quot;);
return 0;
};
&quot;&quot;&quot;)
        for test_recipe in test_recipes:
            config += &apos;EXTERNALSRC:pn-{} = &quot;{}&quot;\n&apos;.format(test_recipe, tmpdir)
            config += &apos;EXTERNALSRC_BUILD:pn-{} = &quot;{}&quot;\n&apos;.format(test_recipe, tmpdir)
        self.write_config(config)
        for test_recipe in test_recipes:
            v = get_bb_vars([&apos;S&apos;,&apos;B&apos;], test_recipe)
            s = v[&apos;S&apos;]
            b = v[&apos;B&apos;]
            self.assertTrue(s == b, &quot;$S != $B : {} != {}&quot;.format(s,b))
        res = bitbake(&quot;{}&quot;.format(&quot; &quot;.join(test_recipes))).status
        self.assertEqual(0, res, &quot;Failed to build two packages with externalsrc, possible regression Yocto [#14907]&quot;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96662</commentid>
    <comment_count>3</comment_count>
    <who name="Ola Nilsson">ola.x.nilsson</who>
    <bug_when>2023-10-09 06:48:02 +0000</bug_when>
    <thetext>I think this was fixed on master by Richards rewrite of package.bbclass in Poky commit 1d6c7af0e35811e66a0b3cd3dcc7e3d15b54f99a.

The bug is probably still on kirkstone.

I tried to update the issue in october of 2022 to reflect that, but I&apos;m not sure I got it right.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96691</commentid>
    <comment_count>4</comment_count>
    <who name="Pavel Zhukov">pavel</who>
    <bug_when>2023-10-12 14:52:38 +0000</bug_when>
    <thetext>(In reply to Ola Nilsson from comment #3)
&gt; I think this was fixed on master by Richards rewrite of package.bbclass in
&gt; Poky commit 1d6c7af0e35811e66a0b3cd3dcc7e3d15b54f99a.
&gt; 
&gt; The bug is probably still on kirkstone.
&gt; 
&gt; I tried to update the issue in october of 2022 to reflect that, but I&apos;m not
&gt; sure I got it right.

This was clear, thank you. But the problem is I could not reproduce with kirkstone commit 195b61756bae2d0066b411eea9e14da9de3992a9 you have mentioned in the description.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96700</commentid>
    <comment_count>5</comment_count>
    <who name="Ola Nilsson">ola.x.nilsson</who>
    <bug_when>2023-10-13 11:07:05 +0000</bug_when>
    <thetext>You wont see any error unless you install both src-packages in the same image, like when building a debugfs.

Check the paths in .../packages-split/PN-src and you should find usr/src/debug/main.c in both.  

A better thing to test is that no source files are installed directly into usr/src/debug.  They should all be in usr/src/debug/PN.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96701</commentid>
    <comment_count>6</comment_count>
    <who name="Ola Nilsson">ola.x.nilsson</who>
    <bug_when>2023-10-13 11:08:28 +0000</bug_when>
    <thetext>I verified that this is still broken on 1d6c7af0e35811e66a0b3cd3dcc7e3d15b54f99a using some small recipes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99532</commentid>
    <comment_count>7</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-08-08 18:26:55 +0000</bug_when>
    <thetext>Pavel,

Bumping to 4.0.21.
Do you expect (hope!) to have time to work on YP bug in the coming weeks and months?
../Randy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100074</commentid>
    <comment_count>8</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-10-31 15:06:39 +0000</bug_when>
    <thetext>move to unassigned. feel free to take back if you have time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102469</commentid>
    <comment_count>9</comment_count>
    <who name="Steve Sakoman">steve</who>
    <bug_when>2025-07-16 13:32:05 +0000</bug_when>
    <thetext>It&apos;s been almost three years and there has been no progress on fixing this.

Closing bug as it is unlikely to get any further attention.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>