Forward port from Zope 2.7 branch. Many changes to fsrefs.py, based on problems I hit using it in real life.