[pacman-dev] multiple extraction from package

Dan McGee dpmcgee at gmail.com
Tue Jul 10 23:34:55 EDT 2007


On 7/9/07, Xavier <shiningxc at gmail.com> wrote:
> The last commit made me remind of a little issue I wanted to bring a few hours ago,
> thanks Dan :)
>
> grep "\.INSTALL" lib/libalpm/*.c
> lib/libalpm/add.c:        } else if(strcmp(entryname, ".INSTALL") == 0) {
> lib/libalpm/package.c:    } else if(strcmp(entry_name,  ".INSTALL") == 0) {
> lib/libalpm/trans.c:    _alpm_unpack(installfn,tmpdir, ".INSTALL");
> lib/libalpm/trans.c:    snprintf(scriptfn, PATH_MAX, "%s/.INSTALL", tmpdir);
>
> The archive is read 3 times, in 3 different places.
> In particular, the .INSTALL file is checked for existence in package.c , for
> knowing the package has a scriptlet.
> In trans.c , the .INSTALL file is extracted to /tmp/ for running the
> preinstall scriptlet.
> And in add.c , the .INSTALL file is extracted to $dbpath/local , which is by
> the way causing some issues :
> http://www.archlinux.org/pipermail/pacman-dev/2007-July/008693.html
>
> I wonder if it wouldn't be possible to read the archive just in one place,
> and extracting files just once.
> Or well, I don't know what is the best way, extracting files to /tmp/ and
> then moving them around (like for backup files), or extracting them several
> times from the archive (like .INSTALL) , or maybe keeping the special dot files
> from the archive in memory or something.
>
> Well, it's not that important, but it's related to the issue in the link
> above, that I would like to fix, so I just wanted to know if everyone was happy
> with the current way pacman reads/extracts files from the archive.

The biggest problem- this isn't exactly easy to clean up.

If we could knock this down to two times, that would be much better,
that is for sure. However, I'm not sure how to do this easily without
doing a lot of changes to libalpm. Of course, these changes are
probably needed bigtime.

-Dan




More information about the pacman-dev mailing list