[pacman-dev] Weird bug in sync/upgrade behavior

Dan McGee dpmcgee at gmail.com
Mon May 12 10:00:05 EDT 2008


On Mon, May 12, 2008 at 8:04 AM, Xavier <shiningxc at gmail.com> wrote:
> On Mon, May 12, 2008 at 2:58 PM, Dan McGee <dpmcgee at gmail.com> wrote:
>  >  diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
>  >  index fcd555e..bfbf995 100644
>  >  --- a/lib/libalpm/cache.c
>  >  +++ b/lib/libalpm/cache.c
>  >  @@ -24,6 +24,7 @@
>  >   #include <stdlib.h>
>  >   #include <errno.h>
>  >   #include <string.h>
>  >  +#include <dirent.h>
>  >
>  >   /* libalpm */
>  >   #include "cache.h"
>  >  @@ -54,6 +55,7 @@ int _alpm_db_load_pkgcache(pmdb_t *db)
>  >         _alpm_log(PM_LOG_DEBUG, "loading package cache for repository '%s'\n",
>  >                   db->treename);
>  >
>  >  +       rewinddir(db->handle);
>  >         while((info = _alpm_db_scan(db, NULL)) != NULL) {
>  >                 _alpm_log(PM_LOG_FUNCTION, "adding '%s' to package
>  >  cache for db '%s'\n",
>  >
>  >  alpm_pkg_get_name(info), db->treename);
>  >
>  >
>
>  Oh no shit, I noticed this and wanted to ask you about it, why you
>  removed that rewinddir call...
>  But then I looked at db_scan code, and it seems like it did a
>  rewinddir itself, so I thought it was fine ...
>  And when you showed your weird bug, I thought about that rewinddir
>  stuff again.. But I didn't say anything.. I suck.
>  I was still building your last git branch to try reproducing it first.

I thought the same thing- I saw a rewinddir call in db_scan, so I
removed what I thought was an extra one here. Either way, I don't plan
on applying the above patch, as we should just do the rewinddir() call
inside db_scan() or do something more sane than the above hackjob. I
just wanted to point out this was the issue.

Allan- I don't know what filesystem you are using, but I wonder if it
has slightly different *dir() semantics so the bug did not manifest
itself there...

-Dan




More information about the pacman-dev mailing list