<?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>15197</bug_id>
          
          <creation_ts>2023-08-18 09:06:00 +0000</creation_ts>
          <short_desc>bitbake does not recognize that git-lfs is not installed when usehead=1 is used</short_desc>
          <delta_ts>2026-10-01 15:48:11 +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>BitBake</product>
          <component>bitbake</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>ACCEPTED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>tom.georgi</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>ccasciato</cc>
    
    <cc>konrad.scherer</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>sivakumar.bs</cc>
    
    <cc>tom.georgi</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>96280</commentid>
    <comment_count>0</comment_count>
    <who name="">tom.georgi</who>
    <bug_when>2023-08-18 09:06:00 +0000</bug_when>
    <thetext>git-lfs was not installed. The error should have been caught by poky and throw an error message accordingly.

The method contains_lfs() under the file bitbake/lib/bb/fetch2/git.py sets the variable refname to the respective specified branch. Since in our case no branch name but usehead=1 is specified, this is empty for us, whereby the subsequent command does not find any git-lfs files.

Bitbake has an instance variable `revision` in this class, which resolves all names as revisions. When specifying usehead=1, HEAD will be resolved as a revision as well.
Instead of using `ud.branches` as refname, `ud.revisions` could be used in this method to solve the bug.

Since in our case the lfs files are local and not downloaded through the network, they can also be fetched in a later step. However, if the data was downloaded through the network, then this would lead to an error. For this reason, we have come to the assumption that this is a bug in BitBake.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96301</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-08-24 15:05:00 +0000</bug_when>
    <thetext>Tom, Can you submit a patch?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96591</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-09-28 15:04:16 +0000</bug_when>
    <thetext>Richard will try to make time for this bug in 5.0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105981</commentid>
    <comment_count>3</comment_count>
    <who name="Siva Balasubramanian">sivakumar.bs</who>
    <bug_when>2026-06-22 14:21:31 +0000</bug_when>
    <thetext>This looks fixed on current master, as a side effect of:

commit 2515fbd10824005fa7f34e87706000c079920366
&quot;fetch: Drop multiple branch/revision support for single git urls&quot;
Richard Purdie, 2025-03-18

That commit collapsed ud.branches/ud.revisions (dicts) down to singular
ud.branch/ud.revision. As part of it, _contains_lfs()&apos;s refname is now
derived from ud.revision instead of ud.branches[name]:

cmd = ud.basecmd + [&apos;grep&apos;, &apos;^[^#].*lfs&apos;, ud.revision + &apos;:.gitattributes&apos;]

ud.revision is always a resolved SHA, including when usehead=1 is set
(HEAD resolves to a real revision during urldata_init), so the original
problem - empty branch under usehead=1 causing the LFS check to silently
no-op - no longer applies.

Confirmed by replaying the old refname = ud.branches[ud.names[0]] logic
against a local repo with LFS-marked .gitattributes: it fails with &quot;fatal:
ambiguous argument &apos;:.gitattributes&apos;&quot;, swallowed by the existing except
(FetchError, ValueError): pass, so _contains_lfs() returns False. The
current ud.revision-based version returns True against the same repo.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>