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

Christian Hesse list at eworm.de
Fri May 28 12:18:45 UTC 2021


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.

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.

> The reason I am trying to figure this out is the approach in the bug
> report only provides cache servers for packages, and not databases.  I'm
> trying to understand why you would cache databases.

Because database file are available on every host anyway. :)

Usually it does not add any harm to transfer a database file in local
network, even if you have to retransfer an newer one from mirror later.
Chance are you do not have to.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20210528/70683e7a/attachment.sig>


More information about the pacman-dev mailing list