[pacman-dev] awful bug in pkg_dup

Xavier shiningxc at gmail.com
Thu Jul 24 18:57:02 EDT 2008


I wasted two hours of my precious sleep while playing with the display 
targets and ShowSize code.
Suppose you have a package loaded with INFRQ_BASE (only name and 
version), then you duplicate it with pkg_dup function.
All this stuff is done first :
   newpkg->size = pkg->size;
   newpkg->isize = pkg->isize;
   newpkg->scriptlet = pkg->scriptlet;
   newpkg->force = pkg->force;
   newpkg->reason = pkg->reason;

Then when calling this accessor and all the following ones:
   newpkg->licenses   = alpm_list_strdup(alpm_pkg_get_licenses(pkg));
...
the INFRQ_DESC level will be loaded with all the infos, including the 
size / isize / etc stuff above.

And finally we have this :
   newpkg->infolevel = pkg->infolevel;

The amazing result is that you end up with a pkg with many empty fields, 
but with the INFRQ_DESC level. So once this is done, it is simply 
impossible to access all this precious information from the frontend.

We should never ever use all these alpm_pkg_get accessors here, it 
doesn't make sense to fill a package while it is being duplicated.




More information about the pacman-dev mailing list