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

Nagy Gabor ngaba at bibl.u-szeged.hu
Tue May 13 04:35:54 EDT 2008

Idézés Xavier <shiningxc at gmail.com>:

> On Mon, May 12, 2008 at 4:00 PM, Dan McGee <dpmcgee at gmail.com> wrote:
> >
> >  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.
> >
> Ok, I just understood how that worked now... I first thought we could
> do rewinddir in db_scan but it's not easy. When we do a full scan, we
> want do init the scan first with db_rewind, then scan each entry one
> by one using one db_scan call each time.
> I preferred the old way rather than the above hack, even if they do
> exactly the same thing. It was a bit less obscure and more consistent:
> _alpm_db_rewind(db);
> while((info = _alpm_db_scan(db, NULL)) != NULL) {

As I see, we always call _alpm_db_scan with NULL param. I think we can remove
this param and modify alpm_db_scan to return with alpm_list_t of packages, which
can be thought as TOC, and the packages can be accessed via alpm_db_read. Thus
the rewinddir stuff can be moved there. On the other side we would lose some
flexibility (however, we can read whole db, and do an ~alpm_pkg_find +
alpm_db_read; and if this is needed more than once it worth loading pkgcache).


SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu
This mail sent through IMP: http://horde.org/imp/

More information about the pacman-dev mailing list