motd symlink from initscripts gets moved on base-files upgrade
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
base-files (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: base-files
On the machines we've upgraded in the Canonical DC, we have the following curious situation:
adconrad@mcmurdo:~$ ls -l /etc/motd*
-rw-r--r-- 1 root root 417 2008-04-09 23:22 /etc/motd
lrwxrwxrwx 1 root root 13 2008-04-03 19:37 /etc/motd.old -> /var/run/motd
-rw-r--r-- 1 root root 266 2008-04-03 19:37 /etc/motd.tail
This seems to be the result of the following code in base-files's postinst:
if [ -f /etc/motd ]; then
oldmd=`awk 'NR > 2' /etc/motd | md5sum | awk '{print $1}'`
newmd=`awk 'NR > 2' /usr/share/
if [ "$oldmd" != "$newmd" ]; then
if grep -q "$oldmd" /usr/share/
awk 'NR <= 2' /etc/motd > /etc/motd.new
awk 'NR > 2' /usr/share/
mv /etc/motd /etc/motd.old
mv /etc/motd.new /etc/motd
fi
fi
fi
If the test was changed from "if [ -f /etc/motd ]; then" to "if [ -f /etc/motd ] && [ ! -L /etc/motd ]; then", this postinst would stop mangling symlinks and should coexist well with the New World Order. (For bonus points, adding a bit of transitional code to fix the broken situation wouldn't hurt... if motd.old is a link and motd isn't, and ugrading from << version_with_fix, assume you broke it..)
This patch looks correct to me, but it fails to fix the previous upgrade breakage. Work in progress.