<?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>15169</bug_id>
          
          <creation_ts>2023-07-22 11:25:12 +0000</creation_ts>
          <short_desc>devtool modify of linux kernel with cfg files in subdirectories fails and tries to copy cfg file</short_desc>
          <delta_ts>2026-07-03 11:12:55 +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>Scripts and Tools</component>
          <version>unspecified</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>6.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Brett Bergquist">bbergquist</reporter>
          <assigned_to name="Siva Balasubramanian">sivakumar.bs</assigned_to>
          <cc>bruce.ashfield</cc>
    
    <cc>ccasciato</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sivakumar.bs</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>96019</commentid>
    <comment_count>0</comment_count>
    <who name="Brett Bergquist">bbergquist</who>
    <bug_when>2023-07-22 11:25:12 +0000</bug_when>
    <thetext>This is with the kirkstone Yocto release.

The kernel recipe has

---
FILESEXTRAPATHS:prepend := &quot;${THISDIR}/${PN}:${THISDIR}/${PN}/cfg:${THISDIR}/${PN}/bsp:${THISDIR}/${PN}/patches:&quot;
---

and 
---
SRC_URI:append = &quot; file://cp-config.scc&quot;
SRC_URI:append = &quot; file://apl-spi-001.cfg&quot;
SRC_URI:append = &quot; file://cp-clock.cfg&quot;
---

These cfg files are within the &apos;cfg&apos; subdirectory.  Within &apos;standard.py&apos; we have in &apos;modify&apos;
---
                for key in local_files.copy():
                    if key.endswith(&apos;scc&apos;):
                        sccfile = open(local_files[key], &apos;r&apos;)
                        for l in sccfile:
                            line = l.split()
                            if line and line[0] in (&apos;kconf&apos;, &apos;patch&apos;):
                                cfg = os.path.join(os.path.dirname(local_files[key]), line[-1])
                                if not cfg in local_files.values():
                                    local_files[line[-1]] = cfg
                                    shutil.copy2(cfg, workdir)
                        sccfile.close()

---
This opens and reads the &apos;scc&apos; file and then computes a path to the &apos;cfg&apos; file based upon the directory of the &apos;scc&apos; file.  In this case, the &apos;scc&apos; file is in a subdirectory called &apos;bsp&apos; and the &apos;cfg&apos; file is in a simply subdirectory called &apos;cfg&apos;.  This then fails to copy the &apos;cfg&apos; file and reports a file not found error.
---
Parsing recipes: 100% |####################################################################################################################################################################| Time: 0:00:23
Parsing of 2832 .bb files complete (0 cached, 2832 parsed). 4341 targets, 95 skipped, 3 masked, 0 errors.
INFO: Mapping virtual/kernel to linux-canoga
Traceback (most recent call last):
  File &quot;/home/brett/yocto/layers/poky/scripts/devtool&quot;, line 338, in &lt;module&gt;
    ret = main()
  File &quot;/home/brett/yocto/layers/poky/scripts/devtool&quot;, line 325, in main
    ret = args.func(args, config, basepath, workspace)
  File &quot;/home/brett/yocto/layers/poky/scripts/lib/devtool/standard.py&quot;, line 852, in modify
    shutil.copy2(cfg, workdir)
  File &quot;/usr/lib/python3.8/shutil.py&quot;, line 435, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File &quot;/usr/lib/python3.8/shutil.py&quot;, line 264, in copyfile
    with open(src, &apos;rb&apos;) as fsrc, open(dst, &apos;wb&apos;) as fdst:
FileNotFoundError: [Errno 2] No such file or directory: &apos;/home/brett/yocto/layers/meta-canoga-bsp/recipes-kernel/linux/linux-canoga/bsp/cp-clock.cfg&apos;
brett@brett-Precision-7740:~/yocto/builds/tsx-dev_build (tsx-dev) $ 

---

The &apos;local_files&apos; has the complete absolute path to the local &apos;cfg&apos; file.  It would seem to me that if the path to the &apos;cfg&apos; is absolute and the file exists at that location, we can simply skip trying to copy the &apos;cfg&apos; this way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96020</commentid>
    <comment_count>1</comment_count>
    <who name="Brett Bergquist">bbergquist</who>
    <bug_when>2023-07-22 11:29:05 +0000</bug_when>
    <thetext>Maybe we should just copy the absolute file?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96126</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-07-27 14:42:04 +0000</bug_when>
    <thetext>Hi Brett,

Does this occur on the master branch as well?
Are you interested in working to fix it, given some advice?

Randy for the YP triage group.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96131</commentid>
    <comment_count>3</comment_count>
    <who name="Brett Bergquist">bbergquist</who>
    <bug_when>2023-07-27 16:17:46 +0000</bug_when>
    <thetext>If by master branch, we are talking about the poky layer, I will try that and report back.

I am willing to fix the issue, but I am struggling a little on what the section of code conceptually is trying to do.

What I see earlier in the code is that all of the local files (represented by the dictionary &apos;local_files&apos;) have already been resolved to absolute paths.  So in local_files we have a key and absolute path value.

The code in question is opening the &apos;scc&apos; file that lists the kernel config files and the references in there could be just a file name.  I am assuming that this was trying to do was to take the relative filename and then produce a absolute path to the file relative to the path of the &apos;scc&apos; file. 

I have worked around locally by checking to see if the relative filename refrences a file in the &apos;local_files&apos; and if the value is an absolute path, this is used as the path to the kernel configuration file and copy that file instead of a computed path relative to the directory of the &apos;scc&apos; file.

This is working locally and I can supply a patch for consideration.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96193</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-08-03 19:55:15 +0000</bug_when>
    <thetext>Brett, 
You seem to be on the right track. 

Please send the change you have so far to the list to get some feedback and/or to have it merged as a step along the path.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96206</commentid>
    <comment_count>5</comment_count>
      <attachid>4968</attachid>
    <who name="Brett Bergquist">bbergquist</who>
    <bug_when>2023-08-08 13:04:52 +0000</bug_when>
    <thetext>Created attachment 4968
Patch to look for local full patch config files

This is what I have locally.  The patch first gets the config file path from the &apos;local_files&apos; dictionary.  If then checks to see if the path for the config file is absolute and if so it uses that path.  If not, it does what the code currently does and computes the path relative to the &apos;scc&apos; file path.

This works but I am not confident that this is the correct direction as I have not spent enough time to completely understand what is trying to be done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97905</commentid>
    <comment_count>6</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-01-18 16:23:46 +0000</bug_when>
    <thetext>Bruce or someone else may take a look but if not, please send the patch as an RFC to the oe-core list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99062</commentid>
    <comment_count>7</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-05-23 15:09:43 +0000</bug_when>
    <thetext>Changes to workdir on master may have fix  this problem since there are no longer copies being made.
Please check.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100091</commentid>
    <comment_count>8</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-10-31 15:09:24 +0000</bug_when>
    <thetext>Bulk move of 5.1 bugs to 5.2. -- YP bug review (Randy)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102099</commentid>
    <comment_count>9</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-05-29 16:08:03 +0000</bug_when>
    <thetext>Moving to 5.3.
Brett do you hope to have time to work on this bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104428</commentid>
    <comment_count>10</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-02-26 16:22:11 +0000</bug_when>
    <thetext>Brett I&apos;m moving this to unassigned so take it back if you find time.
If you want to help someone else, I think a simpler reproducer may be needed
but I&apos;m skimming this during a meeting so maybe not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105910</commentid>
    <comment_count>11</comment_count>
    <who name="Siva Balasubramanian">sivakumar.bs</who>
    <bug_when>2026-06-18 09:30:03 +0000</bug_when>
    <thetext>The original failure no longer reproduces on master — the code that computed the .cfg path from the .scc file&apos;s directory was removed in ce8190c519 (&quot;devtool: Drop oe-local-files and simplify&quot;), confirming Randy&apos;s Comment 7.

To lock this in I wrote an oe-selftest regression test (test_devtool_modify_kernel_cfg_subdirs). Verified it FAILS on the pre-fix tree (d9328e3b0b) with the exact reported FileNotFoundError (copying .cfg from the .scc&apos;s bsp/ dir instead of cfg/) and PASSES on current master. Sent to the oe-core list: 

Suggest resolving once the test merges.

https://patchwork.yoctoproject.org/project/oe-core/patch/20260618091736.2319572-1-sivakumar.bs@gmail.com/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106093</commentid>
    <comment_count>12</comment_count>
    <who name="Siva Balasubramanian">sivakumar.bs</who>
    <bug_when>2026-07-03 11:12:55 +0000</bug_when>
    <thetext>https://git.openembedded.org/openembedded-core/commit/?id=716a14b7b5e468dd7e9f90647188684a1be931cc</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4968</attachid>
            <date>2023-08-08 13:04:52 +0000</date>
            <delta_ts>2023-08-08 13:04:52 +0000</delta_ts>
            <desc>Patch to look for local full patch config files</desc>
            <filename>standard.py.patch</filename>
            <type>text/plain</type>
            <size>936</size>
            <attacher name="Brett Bergquist">bbergquist</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3NjcmlwdHMvbGliL2RldnRvb2wvc3RhbmRhcmQucHkgYi9zY3JpcHRzL2xp
Yi9kZXZ0b29sL3N0YW5kYXJkLnB5CmluZGV4IGUyYTgzMzVhNjIuLjE0N2FjMDE1MzQgMTAwNjQ0
Ci0tLSBhL3NjcmlwdHMvbGliL2RldnRvb2wvc3RhbmRhcmQucHkKKysrIGIvc2NyaXB0cy9saWIv
ZGV2dG9vbC9zdGFuZGFyZC5weQpAQCAtODQ2LDcgKzg0Niw5IEBAIGRlZiBtb2RpZnkoYXJncywg
Y29uZmlnLCBiYXNlcGF0aCwgd29ya3NwYWNlKToKICAgICAgICAgICAgICAgICAgICAgICAgIGZv
ciBsIGluIHNjY2ZpbGU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZSA9IGwuc3Bs
aXQoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIGxpbmUgYW5kIGxpbmVbMF0gaW4g
KCdrY29uZicsICdwYXRjaCcpOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjZmcg
PSBvcy5wYXRoLmpvaW4ob3MucGF0aC5kaXJuYW1lKGxvY2FsX2ZpbGVzW2tleV0pLCBsaW5lWy0x
XSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2ZnID0gbG9jYWxfZmlsZXNbbGlu
ZVstMV1dCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIG5vdCBvcy5wYXRoLmlz
YWJzKGNmZyk6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjZmcgPSBvcy5w
YXRoLmpvaW4ob3MucGF0aC5kaXJuYW1lKGxvY2FsX2ZpbGVzW2tleV0pLCBsaW5lWy0xXSkKICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgbm90IGNmZyBpbiBsb2NhbF9maWxlcy52
YWx1ZXMoKToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsX2ZpbGVz
W2xpbmVbLTFdXSA9IGNmZwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2h1
dGlsLmNvcHkyKGNmZywgd29ya2RpcikK
</data>

          </attachment>
      

    </bug>

</bugzilla>