Bug#47404: dpkg: dpkg does not reconfigure a package when install fails
When an error occurs during unpacking, dpkg should unwind all the way back to
step 1. This means running new-postrm abort-upgrade/abort-install, as well
as old-postinst abort-upgrade. This is necessary because the old prerm and
the new preinst have both been run during an upgrade.
Here is an example where not doing this may break perl:
$ sudo dpkg -i /mnt/big/debian/repo/dists/potato/main/binary-i386/interpreters/perl-5.005_5.005.03-4.deb
(Reading database ... 74984 files and directories currently installed.)
Preparing to replace perl-5.005 5.005.03-3 (using .../perl-5.005_5.005.03-4.deb) ...
<deleted output from prerm script>
Unpacking replacement perl-5.005 ...
dpkg-deb (subprocess): unexpected end of file in member data in /mnt/big/debian/repo/dists/potato/main/binary-i386/interpreters/perl-5.005_5.005.03-4.deb
gzip: stdin: unexpected end of file
dpkg-deb: subprocess gzip -dc returned error exit status 1
dpkg: error processing /mnt/big/debian/repo/dists/potato/main/binary-i386/interpreters/perl-5.005_5.005.03-4.deb (--install):
subprocess dpkg-deb --fsys-tarfile (EOF) returned error exit status 2
Errors were encountered while processing:
Afterwards, the system did not have an asm link for perl because it was
removed by the prerm script.
-- System Information
Debian Release: potato
Kernel Version: Linux gondor 2.2.12 #2 Sat Sep 18 12:11:40 EST 1999 i586 unknown
Versions of the packages dpkg depends on:
ii libc6 2.1.2-1 GNU C Library: Shared libraries and timezone
ii libncurses4 4.2-3.2 Shared libraries for terminal handling
ii libstdc++2.10 2.95.2-0pre2 The GNU stdc++ library