[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg reassembly of split packages, when to purge



Right, the situation with reassembly of fragments is as follows:

dpkg, whenever you ask it to install or unpack (or update the
`available packages' info from) a .deb file will first call dpkg-split
to see if the file is part of a multipart package.

If it is then dpkg-split will check to see whether it has the other
parts yet.  If it hasn't it will take a copy of the file whose name
was given on the dpkg command line and put it in a private directory
in /var/lib/dpkg, pending availability of the remaining parts.  dpkg
will then go on to process the next file it has to deal with, if any.

When dpkg-split has all the parts will reassemble the package, delete
the parts from the private directory, and hand the reassembled file to
dpkg, which processes it as if it had been the file provided by the
user (except that it deletes it afterwards).

If it isn't part of a multipart file then dpkg-split will make this
known to dpkg, and dpkg will then use dpkg-deb to extract the control
information from the file in the usual way.

For all other purposes multipart packages are just one package.  The
package part format is a layer around the ordinary package format, and
it isn't interpreted by dpkg (or dpkg-deb) directly.  When dpkg-split
is used to put parts back together it unwraps the extra layer and
spits out the original .deb file, which is byte-for-byte identical to
the original.  (In fact, the several parts of the multi-part format do
indeed contain between them all the bytes of the original file, though
this isn't necessarily visible to dpkg-split's callers.)

Multipart packages have only one package name, only one control file,
appear only once in the Packages file, and will only appear once in
dselect.

Now, clearly I don't want to delete the file whose name is passed to
dpkg (either by the user or by one of dselect's method scripts or
automatically found by dpkg when it was given the --recursive option).

The question is when to delete the copies in /var/lib/dpkg ?

If I delete them too soon the user will have to re-present the
floppies contaning the parts, or wait for them to be downloaded again,
or whatever.  In extreme cases the user may be unable to proceed at
all, because in order to present dpkg with a new part of the file they
need to do something that causes it to forget the parts it already
has.

If I delete them too late I run the risk of the user running out of
disk space halfway through a partially-botched or unusual
installation, or of the files never being deleted because the user
doesn't run cron and never invokes dselect again.

Ian.


Reply to: