When there's absolute symlinks in a linked directory in the `keg`
(e.g. `bin`)that point to the `Cellar` or `opt` then linking the `keg`
will fail before the `Cellar` or `opt` has been linked.
ClosesHomebrew/homebrew#44306.
ClosesHomebrew/homebrew#44329.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Link the keg that was linked before migration. Don't use
newformula.installed_prefix to detect keg to link, because it can break
things (i.e. if intalled formula is outdated, then
newformula.installed_prefix can be not the same as installed prefix
before update).
ClosesHomebrew/homebrew#42857.
Signed-off-by: Xu Cheng <xucheng@me.com>