reinstall: fix incorrect use of Formula.canonical_name

Fixes #27117.