<?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>15126</bug_id>
          
          <creation_ts>2023-05-24 13:50:36 +0000</creation_ts>
          <short_desc>Github Mirror does not work if SRC_URI contains downloadfilename</short_desc>
          <delta_ts>2025-11-12 16:03:36 +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>4.2</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</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>5.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Quirin Gylstorff">quirin.gylstorff</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>pavel</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>yoann.congal</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>95587</commentid>
    <comment_count>0</comment_count>
    <who name="Quirin Gylstorff">quirin.gylstorff</who>
    <bug_when>2023-05-24 13:50:36 +0000</bug_when>
    <thetext>Dear all,

we have the problem that is not possible with d97d62e2 (bitbake-user-manual: add BB_HASH_CODEPARSER_VALS) to use a Github Mirror if the SRC_URI contains a downloadfilename.

I bisected the behavior changed with 96c30007 (fetch2: fix downloadfilename issue with premirror).

As Scott Weaver has written in https://bugzilla.yoctoproject.org/show_bug.cgi?id=13039#c10 the expected and documented behavior was that using a Mirror will the same file name as in the original URL.  downloadfilename should only  change the name of the locally stored file.

With:
SRC_URI = &quot;https://somewhere.org/example-1.0.0.tgz;downloadfilename=some-example-1.0.0.tgz&quot;
MIRROR = &quot;https://.*&quot;, &quot;https:///somemirror.org&quot;

the expected result was:
&quot;https:///somemirror.org/example-1.0.0.tgz;downloadfilename=some-example-1.0.0.tgz&quot;

but instead the following was given:
&quot;https:///somemirror.org/some-example-1.0.0.tgz;downloadfilename=some-example-1.0.0.tgz&quot;

The Mirrors I know do not change the name of the file the provide. The  only known exception is https://downloads.yoctoproject.org/mirror/sources/, which does not mirror
the files with the original names but with the names defined in downloadfilename.   

My question is:

 - What is the intended behavior in case of  using a MIRROR with downloadfilename set in SRC_URI?

- If it is the current implementation the documentation needs to adapted.

Kind regards

Quirin Gylstorff
Siemens AG</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95598</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2023-05-25 19:10:57 +0000</bug_when>
    <thetext>I&apos;m not entirely sure what you mean by a &quot;Github mirror&quot;.  I presume you mean an arbitrary source mirror.

There&apos;s definitely two conflicting use-cases here.

The first is people that use a fully populated DL_DIR as a source mirror. This is a documented use case and a source mirror is expected to have a specific structure, for example git repositories can be exposed as tarballs with a specific structure and name.  So in this case a source mirror isn&apos;t an arbitrary URL, it&apos;s specifically a bitbake-compatible source mirror.

The second use-case is &quot;the upstream server is bad, here is an alternative&quot;.  We use this in oe-core, for example the Debian archive URLs have mirror entries which use snapshot.debian.org to handle tarballs which are purged from the archive.

The problem is that these two use-cases have different semantics: in the first the downloadfilename in DL_DIR becomes the name in the mirror. In the latter, the real name not the downloadfilename is expected.

It&apos;s not really feasible to support both usecase fully as they&apos;re contradictory.  I suspect primarily supporting the first use case and the latter mostly works will be the right thing to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95599</commentid>
    <comment_count>2</comment_count>
    <who name="Quirin Gylstorff">quirin.gylstorff</who>
    <bug_when>2023-05-26 06:55:33 +0000</bug_when>
    <thetext>Our use case would be the second where the upstream server is not reachable so take an alternative. 

We did not find any documentation which indicated that we have the current behavior, therefore we were not sure which is the correct. 

Could the documentation adapted?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95600</commentid>
    <comment_count>3</comment_count>
    <who name="Pavel Zhukov">pavel</who>
    <bug_when>2023-05-26 11:35:26 +0000</bug_when>
    <thetext>(In reply to Quirin Gylstorff from comment #2)
&gt; Our use case would be the second where the upstream server is not reachable
&gt; so take an alternative. 
&gt; 
&gt; We did not find any documentation which indicated that we have the current
&gt; behavior, therefore we were not sure which is the correct. 
&gt; 
&gt; Could the documentation adapted?

I think you&apos;re looking for this doc: https://docs.yoctoproject.org/dev-manual/efficiently-fetching-sources.html . 
Implementations examples: https://low-level.wiki/mirrors/yocto_sources.html https://www.mndet.net/2018/12/28/yocto-mirrors.html Some of them may be outdated though</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95602</commentid>
    <comment_count>4</comment_count>
    <who name="Quirin Gylstorff">quirin.gylstorff</who>
    <bug_when>2023-05-30 07:29:15 +0000</bug_when>
    <thetext>An internal discussed solution was:
If the fetcher does not find the `downloadfilename` on the mirror -&gt; it tries the mirror with the original file name.

Would this be an acceptable solution?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>