Commit Message

Sync databases (and signatures) are downloaded into a temporary directory.
On success, they are copied into the sync directory.
Currently, this achieves nothing but adding complexity, but it does open
up the possibility of validating sync databases on download before replacing
the old version.
Signed-off-by: Allan McRae <allan@archlinux.org>
---
This patch was long enough, and there is still quite a bit to do to validate
the download sync databases before replacing the old ones, so best to stop
here.
lib/libalpm/be_sync.c | 90 +++++++++++++++++++++++++++++++++----------
1 file changed, 69 insertions(+), 21 deletions(-)

On 8/1/20 11:31 pm, Dave Reisner wrote:
> On Wed, Jan 8, 2020, 07:30 Allan McRae <allan@archlinux.org> wrote:> >> Sync databases (and signatures) are downloaded into a temporary directory.>> On success, they are copied into the sync directory.>>> Why not use a temporary file in the sync dir? That allows you to rename> atomically instead of copy+unlink. My guess is it's less code, too.
Two reasons - both may be wrong!
1) that looked difficult with _alpm_download.
2) I was hoping keeping the file names the same would mean minimal
changes to get signature validation working on the newly downloaded db.
What I could do, is create the temp directory inside the sync directory.
Allan