Comment 7 for bug 634387

Revision history for this message
Nathan Stratton Treadway (nathanst) wrote :

For what it's worth, here's the code from initscripts.postinst:
  if [ ! -f /etc/motd.tail ]
  then
          if [ -f /etc/motd ]
          then
                  sed 1d /etc/motd > /etc/motd.tail
                  [ -s /etc/motd.tail ] || rm -f /etc/motd.tail
          fi
  fi

The "[ ! -f /etc/motd.tail ]" at the front means the code only fires if /etc/motd.tail doesn't exist... and thus if leave an empty file there (rather than deleting it completely), that should prevent the motd->motd.tail copy from being performed on the next initscript upgrade.

Still, it definitely seems like a bug for the "motd" file that has just been generated by the /etc/updated-motd.d/ scripts to get copied into the "motd.tail" file during a package upgrade....

Looking back in the revision history of that script, it seems this code was added back in version 2.86.ds1-14.1ubuntu1 as part of the switch to a tmpfs /var/run directory:
  http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/lucid/sysvinit/lucid/revision/42/debian/initscripts/postinst?remember=42

Anyway, I wonder if this logic is still needed -- or, if so, if it could at least be protected by a "if dpkg --compare-versions" statement to make sure it only happens when it should?

(Or, at least, don't perform the copy if /etc/motd is already a symlink to /var/run/motd...)

Nathan