Anchor the upgrade directory regex to avoid potential false positives

This means we can't use upgrade directories named like
rt-4.1.13-18-gf349104, but that's okay.
Bail if it looks like --datadir is wrong during upgrade
Merge branch '4.0/rt-setup-database-upgrade-bulletproofing' into 4.0-trunk