[pacman-dev] pacman cold caches performance, too much stat()ing

Dimitrios Apostolou jimis at gmx.net
Sun Dec 13 05:59:39 EST 2009


On Sat, 12 Dec 2009, Nagy Gabor wrote:
> (the only remaining sanity check is splitname).

Correct, and it has just caught an error for me:

$ ./src/pacman/.libs/lt-pacman -Sup
:: Starting full system upgrade...
error: invalid name for database entry '.lastupdate'
error: invalid name for database entry '.lastupdate'
error: invalid name for database entry '.lastupdate'
  local database is up to date


It seems there is a non-directory file inside the sync db, I missed this 
one among the heaps of strace output. Is this intentional? Is this 
actually used? If it is, and since _alpm_db_populate() knows about the db 
structure, it should avoid that specific case.

The following patch takes care of that special case and also reserves all 
hidden files for special database purposes, not db entries:

--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -238,7 +238,8 @@ int _alpm_db_populate(pmdb_t *db)
                 const char *name = ent->d_name;
                 pmpkg_t *pkg;

-               if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
+               /* skip hidden files and '.' and '..' subdirectories */
+               if (name[0] == '.') {
                         continue;
                 }
                 pkg = _alpm_pkg_new();



Dimitris


More information about the pacman-dev mailing list