<?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>16051</bug_id>
          
          <creation_ts>2025-10-31 15:02:56 +0000</creation_ts>
          <short_desc>Add a check for git:// SRC_URI without a SRCREV</short_desc>
          <delta_ts>2026-07-21 09:22:08 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Build Testing</product>
          <component>sanity</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>IN PROGRESS DESIGN</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>6.1 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yoann Congal">yoann.congal</reporter>
          <assigned_to name="Sai Sneha">saisneha196</assigned_to>
          <cc>randy.macleod</cc>
    
    <cc>saisneha196</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>103166</commentid>
    <comment_count>0</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-10-31 15:02:56 +0000</bug_when>
    <thetext>A git:// SRC_URI without a SRCREV triggers a parse error under BB_NO_NETWORK, break the mirroring tests and hit upstream servers on each build. While this might be acceptable for extern layers, we try to avoid that for YP layers (oe-core and meta-openembedded).

A recipe QA check will help avoid that.

Ref: https://lists.openembedded.org/g/openembedded-devel/topic/115911777#msg121235</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103167</commentid>
    <comment_count>1</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-10-31 15:50:44 +0000</bug_when>
    <thetext>Note: it would be nice to add this check to the Yocto check-layer test set.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103169</commentid>
    <comment_count>2</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-10-31 18:20:33 +0000</bug_when>
    <thetext>Idea: add a QA check outside of checklayer then add it to CHECKLAYER_REQUIRED_TESTS
This way users can still benefit from the QA check without running checklayer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103213</commentid>
    <comment_count>3</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-11-06 15:44:25 +0000</bug_when>
    <thetext>Idea: Use &quot;layer-specific&quot; QA checks to enforce it on oe-core (and most likely meta-openembedded) but not by default.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104553</commentid>
    <comment_count>4</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2026-03-06 17:02:13 +0000</bug_when>
    <thetext>The trivial implementation of this enhancement seem to have triggered underlying problems: Corentin has posted a RFC series about this:
[RFC PATCH 0/4] Clean AUTOREV usage, add revision check for every SCM URI
https://lore.kernel.org/openembedded-core/20260304104342.869457-1-corentin.guillevic@smile.fr/T/#u</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104952</commentid>
    <comment_count>5</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2026-04-03 09:25:41 +0000</bug_when>
    <thetext>(Unassigning myself since a do not realistically have the time to work on this)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105411</commentid>
    <comment_count>6</comment_count>
    <who name="Sai Sneha">saisneha196</who>
    <bug_when>2026-05-12 05:36:29 +0000</bug_when>
    <thetext>Hi, I would like to work on this issue as part of my Yocto contribution work. I have been reviewing the discussion around the missing SRCREV QA check, AUTOREV handling, and the related RFC patch series from Corentin Guillevic. I am currently reproducing the issue locally and analyzing the interactions between SRCREV expansion, SCM URIs, and fetcher behavior. If there are no objections, I would like to work on proposing a fix for this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105412</commentid>
    <comment_count>7</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2026-05-12 07:10:18 +0000</bug_when>
    <thetext>Hi Sai,

Thank you for working on this :)

I&apos;m assigning the ticket to you to make it official.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105703</commentid>
    <comment_count>8</comment_count>
    <who name="Sai Sneha">saisneha196</who>
    <bug_when>2026-06-04 06:51:42 +0000</bug_when>
    <thetext>Hi all,

After reading through all the mailing list feedback carefully and 
spending time studying the bitbake fetcher code, I think I now have 
a much clearer picture of what went wrong with my approach. I wanted 
to summarize my understanding before attempting v6.

The core problem with v5:

The bigger issue is that intercepting at the vardepvalue level in 
base.bbclass was the wrong approach entirely. when I suppress the 
hash computation for recipes with missing SRCREV I am also 
accidentally breaking something important bitbake uses that hash 
to know when to re-run do_fetch. So if a branch or tag changes 
upstream do_fetch would silently not re-run which is worse than 
the original problem.

Other issues I missed:

- Using d.getVar(candidate, False) misses MACHINE/DISTRO overrides. 
  Paul is right that override resolution is the bitbake parser&apos;s job, 
  not something OE-core should be reimplementing.

- Hardcoding git/gitsm/hg/svn was fragile. bitbake already has 
  supports_srcrev() on each fetcher class for exactly this purpose.

- The parse-time warning was wrong. src-uri-bad is purely a QA-time 
  check I should not have added parse-time warnings.

- The problem is broader than just missing SRCREV as a SRCREV set to 
  a branch or tag name instead of a commit hash causes the same 
  reproducibility issues.

- The tag= skip was wrong since the selftest recipe should use 
  INSANE_SKIP instead of skipping tag= globally.

- The CHECKLAYER_REQUIRED_TESTS decision needs proper discussion 
  not a unilateral call in the cover letter.

Where I think the fix should go:

Richard suggested fixing this in the bitbake fetchers themselves 
using supports_srcrev(). I am not sure if that means changes to the 
BitBake repository itself, or just using supports_srcrev() within 
OE-core. Could someone clarify the right direction?

My current thinking for OE-core is a simple QA check in 
insane.bbclass using oe.qa.handle_error() with supports_srcrev() 
to identify which URIs need checking, along with fixing the 
gitunpackoffline selftest with INSANE_SKIP. But I want to make sure 
this aligns with what the maintainers have in mind before writing 
more code.

Thanks again for the thorough review it was genuinely helpful.

Sai Sneha</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105707</commentid>
    <comment_count>9</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-06-04 14:25:54 +0000</bug_when>
    <thetext>Sai, Please also post your last comment/sumary to the email thread 
if you haven&apos;t do already.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105737</commentid>
    <comment_count>10</comment_count>
    <who name="Sai Sneha">saisneha196</who>
    <bug_when>2026-06-05 06:13:00 +0000</bug_when>
    <thetext>Ok Sure, Randy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105778</commentid>
    <comment_count>11</comment_count>
    <who name="Sai Sneha">saisneha196</who>
    <bug_when>2026-06-09 09:07:51 +0000</bug_when>
    <thetext>Following up on suggestions to fix this in the BitBake 
fetchers using supports_srcrev() and I have tried ipmlementing that 
approach locally. here is what I did and how it works.

the fix has two parts:

part 1 — BitBake fix (prevent parse crash):
The crash happens in setup_revisions() when srcrev_internal_helper() 
raises a FetchError for missing SRCREV. This propagates up through 
expandWithRefs() as an ExpansionError which halts parsing for all 
recipes. The fix catches FetchError in setup_revisions() and sets 
a missing_srcrev flag on the FetchData object:

  def setup_revisions(self, d):
      try:
          self.revision = srcrev_internal_helper(self, d, self.name)
      except FetchError:
          self.revision = None
          self.missing_srcrev = True

git.py and hg.py also needed a guard to prevent calling 
latest_revision() when missing_srcrev is set, since that would 
trigger a live network fetch under BB_NO_NETWORK=1.

part 2 — OE-core QA check (insane.bbclass):
a simple test_missing_srcrev() in do_recipe_qa uses supports_srcrev() 
to identify which URIs need checking:

  def test_missing_srcrev(pn, d):
      import bb.fetch2
      try:
          fetcher = bb.fetch2.Fetch(
              (d.getVar(&apos;SRC_URI&apos;) or &apos;&apos;).split(), d)
          for url in fetcher.ud:
              ud = fetcher.ud[url]
              if ud.method.supports_srcrev() and \
                 getattr(ud, &apos;missing_srcrev&apos;, False):
                  oe.qa.handle_error(&quot;missing-srcrev&quot;,
                      &quot;%s: SRCREV not set for SCM URI %s&quot; % (pn, url), d)
      except bb.fetch2.FetchError:
          pass

Test results:

  $ bitbake -p 2&gt;&amp;1 | grep -E &quot;(WARNING|ERROR|SRCREV)&quot;
  WARNING: You are running bitbake under WSLv2...
  Summary: There was 1 WARNING message.
  (no parse crash, all recipes parse cleanly)

  $ bitbake -c recipe_qa -f test-fetcher 2&gt;&amp;1 | grep -E &quot;(WARNING|ERROR|missing-srcrev)&quot;
  WARNING: test-fetcher-1.0-r0 do_recipe_qa: QA Issue: test-fetcher: 
  SRCREV not set for SCM URI git://github.com/example/project.git [missing-srcrev]

  $ bitbake -c recipe_qa test-srcrev 2&gt;&amp;1 | grep -E &quot;(WARNING|ERROR|missing-srcrev)&quot;
  ERROR: test-srcrev-1.0-r0 do_recipe_qa: QA Issue: test-srcrev: 
  SRCREV not set for SCM URI git://github.com/example/project.git [missing-srcrev]

selftest results:
  test_git_unpack_nonetwork      PASSED
  test_git_unpack_nonetwork_fail PASSED
  test_git_patchtool             PASSED
  test_git_patchtool2            PASSED
  test_just_parse                PASSED
  test_warnings_errors           PASSED
  test_invalid_recipe_src_uri    PASSED

Changes are minimal:
  BitBake:  3 files, 8 insertions, 3 deletions
  OE-core:  1 file,  16 insertions, 1 deletion

Does this approach align with what was suggested? I am happy to 
refine it further based on feedback.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105887</commentid>
    <comment_count>12</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2026-06-15 13:21:46 +0000</bug_when>
    <thetext>Link to the work in progress patch:
[PATCH v5 0/4] Add missing SRCREV check for SCM URIs - Sai Sneha
https://lore.kernel.org/all/20260602062940.3107241-1-saisneha196@gmail.com/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106236</commentid>
    <comment_count>13</comment_count>
    <who name="Sai Sneha">saisneha196</who>
    <bug_when>2026-07-21 09:22:08 +0000</bug_when>
    <thetext>Hi all,

I will not be able to continue working on this bug and am 
unassigning myself so someone else can pick it up.

Thank you all for the guidance.

Sai Sneha</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>