[pacman-dev] [PATCH 1/1] support http header to indicate an expected failure

Allan McRae allan at archlinux.org
Fri May 28 12:52:32 UTC 2021

On 28/5/21 10:18 pm, Christian Hesse wrote:
> Allan McRae <allan at archlinux.org> on Fri, 2021/05/28 20:43:
>>> Ok, let's see a more detailed example:
>>> * pacman sends a request to pacredir, the header contains a timestamp from
>>>   synced database file in /var/lib/pacman/sync/:
>>>   If-Modified-Since: Fri, 28 May 2021 04:38:25 GMT
>>> * pacredir sends HEAD requests to pacserve on hosts in local network
>>> * pacserve answers with 200, but the header contains a timestamp:
>>>   Last-Modified: Fri, 28 May 2021 04:38:25 GMT
>>> * pacredir sends a 307 with redirect to the host with most recent db file
>>> - or 404 if all requested db files are older or of same age as local file
>> OK...  so pacredir never checks for the latest database availability on
>> a mirror if there is a newer database on one of the hosts.
> Please note that pacredir does not known about mirrors at all!
> It tries to redirect in local network - and returns 404 if it can not. It's
> pacman that skips to the mirrors.

I was using "mirror" to distinguish external servers from hosts on the
local network.

> That's why pacman should not consider a 404 a permanent error: The next
> request can result in a successful redirect.
>> Does this
>> mean the "new" database on the hosts network could be long out of date,
>> but as long as it is newer than the local machine being updated, that is
>> what will be used?
> Well, out-of-date is a term that does barely match here... pacman does known
> about the date of its current database files only. So yes, more recent
> database files are used as long as they are newer than the local ones - even
> if out-of-date compared with a mirror.
> That's why the pacredir documentation tells you to run `pacman -Sy` twice to
> be sure: First run fetches the newest database from local network, second run
> (where pacredir returns 404) fetches from mirror if a newer version is
> available.

This does very little to convince me that the CacheServer proposal
should be used for databases.


More information about the pacman-dev mailing list