Julian,

first of all, you are right, I did mix up the series, I'll fix that.

Now, Michael Vogt (mvo), Debian's APT main developer is currently
reviewing the one line fix that solves this issue.

I have a reproducer and was able to identify the root cause and prepare
a fix.

The source of the problem is the following :

    string msg = "\nIndex-File: true";
    // FIXME: this really should use "IndexTarget::IsOptional()" but that
    //        seems to be difficult without breaking ABI
    if (ShortDesc().find("Translation") != 0)

As outlined in the FIXME, IndexTarget::IsOptional() should be used, and
that is what started to happen with Wily. The code now reads :

   if(Target.IsOptional)
      msg += "\nFail-Ignore: true";

Here is the complete explanation as provided to MVO :

"When the Queue responsible for fetching the Package file runs, it builds the
Custom600 header with the following method :

> // AcqIndex::Custom600Headers - Insert custom request headers           
> /*{{{*/                                    
> // ---------------------------------------------------------------------      
>                                      
> /* The only header we use is the last-modified header. */                     
>                                      
> string pkgAcqIndex::Custom600Headers()                                        
>                                      
> {                                                                             
>                                      
>    string Final = _config->FindDir("Dir::State::lists");                      
>                                      
>    Final += URItoFileName(RealURI);                                           
>                                      
>    if (_config->FindB("Acquire::GzipIndexes",false))                          
>                                      
>       Final += ".gz";                                                         
>                                      
>                                                                               
>                                      
>    string msg = "\nIndex-File: true";                                         
>                                      
>    // FIXME: this really should use "IndexTarget::IsOptional()" but that      
>                                      
>    //        seems to be difficult without breaking ABI                       
>                                      
>    if (ShortDesc().find("Translation") != 0)                                  
>                           
>       msg += "\nFail-Ignore: true";                                           
>                                      
>    struct stat Buf;                                                           
>                                      
>    if (stat(Final.c_str(),&Buf) == 0)                                         
>                                      
>       msg += "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);                 
>                                      
>                                                                               
>                                      
>    return msg;                                                                
>                                      

The custom header is set with "Fail-Ignore: true" in the case of a Translation
file. This was true until Wily when the code got refactored to use
"IndexTarget::IsOptional" as mentionned in the FIXME.

As far as I can tell, the issue here is that this is wrong :

        if (ShortDesc().find("Translation") != 0)

when string::find() does not find the string, it returns string::npos so this
test is always true. This means that when Packages is downloaded, Fail-Ignore:
is also set to true, which means that TryNextMirror() will not retry.

In MirrorMethod::Failed() :

>    if (!Queue->FailIgnore && TryNextMirror())                                 
>                                      
>       return;                                                                 
>                                      

Changing the test in pkgAcqIndex::Custom600Headers() to be :

if (ShortDesc().find("Translation") != string::npos)

Seems to fix the issue quite nicely.  From what I can tell, this is the only
place where I found that test on 0. Other places do test with string::npos.
"

As soon as MVO is ok with this, I will SRU the modification and upload
the fix.

Kind regards,

...Louis

** Changed in: apt (Ubuntu Trusty)
       Status: Invalid => In Progress

** Changed in: apt (Ubuntu Xenial)
       Status: In Progress => Invalid

** Changed in: apt (Ubuntu Trusty)
   Importance: Undecided => Medium

** Changed in: apt (Ubuntu Xenial)
   Importance: Medium => Undecided

** Changed in: apt (Ubuntu Trusty)
     Assignee: (unassigned) => Louis Bouchard (louis-bouchard)

** Changed in: apt (Ubuntu Xenial)
     Assignee: Louis Bouchard (louis-bouchard) => (unassigned)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1625667

Title:
  Trusty: apt does not try next mirror if index file download fails with
  mirror:// source

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1625667/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to