Package: apt-cacher-ng Version: 0.7.26-1 Background: I'm trying to get ACNG to work as an installation source for the Fedora 20 network installer. The basic setup for this was not hard--- see attached for a VfilePattern update I was going to send in---but I've run into a bug in ACNG that has to do with an unusual access pattern by the Fedora installer.
The symptom is that, once the installer begins the actual installation process, it fails with "error populating transaction" and the name of a package. This happens after successfully downloading a handful of RPM files (plus some .img files earlier in the process). The named package, invariably, is the last one shown in ACNG's log file. I did some investigation. For some reason, the installer doesn't download full RPM files, at least initially; it always requests bytes 1384-NNNN, where NNNN is a four- or five-digit number well short of the actual size of the file. (Some googling seems to indicate that the installer is skipping the RPM header, which is 1384 bytes long, but I can't tell why it's not downloading the full remainder of the file.) Here's an example of such a request: GET /fedora/releases/20/Fedora/x86_64/os/Packages/g/geronimo-jta-1.1.1-15.fc20.noarch.rpm HTTP/1.1 Range: bytes=1384-6867 User-Agent: urlgrabber/3.9.1 yum/3.4.3 Host: cache.example.com:3142 Accept: */* (Note that this file is actually 21668 bytes in size.) The pattern I've observed, after multiple test runs, is that the first few such requests are serviced correctly, with 206 responses. But then, one of those requests inexplicably gets a "200 OK"---and that's the one that causes the installer to bork. I traced through the code, and got it down to the if-condition at job.cc:1054. At that point, 'fistate' is always 4, and 'nGooddataSize' is usually bigger than 'm_nReqRangeFrom' (always 1384). But when the incorrect 200 response was produced, 'nGooddataSize' was 1073. The branch that should have resulted in a 206 header was not followed. This appears to be an as-yet unhandled corner case.
These modifications/additions to VfilePattern allow the Fedora 20 installer to pull the files it needs via apt-cacher-ng. (acng.conf needs to be updated with the new regex as well) diff -ru apt-cacher-ng-0.7.26.orig/source/acfg_defaults.cc apt-cacher-ng-0.7.26/source/acfg_defaults.cc --- apt-cacher-ng-0.7.26.orig/source/acfg_defaults.cc 2014-03-01 11:43:45.000000000 -0500 +++ apt-cacher-ng-0.7.26/source/acfg_defaults.cc 2014-04-13 17:47:01.005905617 -0400 @@ -41,7 +41,8 @@ "|filelists\\.xml\\.gz|filelists\\.sqlite\\.bz2|repomd\\.xml" // SL, http://ra.khe.sh/computers/linux/apt-cacher-ng-with-yum.html "|packages\\.[a-zA-Z][a-zA-Z]\\.gz|info\\.txt|license\\.tar\\.gz|license\\.zip" //opensuse "|"ALXPATTERN // Arch Linux - "|metalink\\?repo|.*prestodelta\\.xml\\.gz|repodata/.*\\.(xml|sqlite)"COMPRLIST // CentOS + "|metalink\\?repo|.*prestodelta\\.xml\\.gz|repodata/.*\\.(xml|sqlite)"COMPOPT // CentOS + "|\\.treeinfo|vmlinuz|(initrd|product|squashfs|updates)\\.img" // fedora ")$" // end of only-filename paterns "|/dists/.*/installer-[^/]+/[^0-9][^/]+/images/.*"); // d-i stuff but not containing a number (year) in the revision directory (like "current", "beta", ...)