fix handling of symlinks in pattern (path vs. canonical path) (now also on windows)
(cherry-picked from 3deb9d4)