dash upgrade problem in squeeze

I’m not the only person affected by upgrade issues with dash /bin/sh diversion, but I thought I would document the behavior and quick fix for upgrading, since I just got bitten (again) by this on armel upgrading my sheevaplug this morning. See http://bugs.debian.org/538822 for lots of detail.

mshuler@sheeva:~$ sudo apt-get upgrade -V
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
   dash (0.5.5.1-6 => 0.5.5.1-7.2)
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/101 kB of archives.
After this operation, 4,096 B of additional disk space will be used.
Do you want to continue [Y/n]? 
Preconfiguring packages ...
(Reading database ... 19484 files and directories currently installed.)
Preparing to replace dash 0.5.5.1-6 (using .../dash_0.5.5.1-7.2_armel.deb) ...
Unpacking replacement dash ...
dpkg: error processing /var/cache/apt/archives/dash_0.5.5.1-7.2_armel.deb (--unpack):
 trying to overwrite '/bin/sh', which is also in package bash 4.1-3
configured to not write apport reports
                                      Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/dash_0.5.5.1-7.2_armel.deb
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)

mshuler@sheeva:~$ dpkg-divert --list /bin/sh
local diversion of /bin/sh to /bin/sh.distrib
mshuler@sheeva:~$ readlink -f /bin/sh
/bin/dash
mshuler@sheeva:~$ ls -l /bin/sh.distrib
lrwxrwxrwx 1 root root 4 Sep 29 17:37 /bin/sh.distrib -> bash

remove the /bin/sh diversion and upgrade goes smoothly:

dpkg-divert --remove /bin/sh

mshuler@sheeva:~$ sudo dpkg-divert --remove /bin/sh
Removing 'local diversion of /bin/sh to /bin/sh.distrib'
mshuler@sheeva:~$ dpkg-divert --list /bin/sh
mshuler@sheeva:~$ readlink -f /bin/sh
/bin/dash
mshuler@sheeva:~$ sudo apt-get upgrade -V
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
   dash (0.5.5.1-6 => 0.5.5.1-7.2)
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/101 kB of archives.
After this operation, 4,096 B of additional disk space will be used.
Do you want to continue [Y/n]? 
Preconfiguring packages ...
(Reading database ... 19483 files and directories currently installed.)
Preparing to replace dash 0.5.5.1-6 (using .../dash_0.5.5.1-7.2_armel.deb) ...
Adding 'diversion of /bin/sh to /bin/sh.distrib by dash'
Unpacking replacement dash ...
Processing triggers for man-db ...
Setting up dash (0.5.5.1-7.2) ...
Removing 'diversion of /bin/sh to /bin/sh.distrib by dash'
Adding 'diversion of /bin/sh to /bin/sh.distrib by bash'
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB

Total disk space freed by localepurge: 0 KiB

mshuler@sheeva:~$