The issue is that locate-library returns spurious paths like ".*/tramp" or ".*xxx/tramp.gz" instead of returning a valid path to the library or nil if no matching path is found. This is both unexpected and incorrect given this function name and spec. It can cause user inconvenience or pose a security/privacy issue because a random file named "tramp" or "tramp.gz" placed in some directory of the load-path can be loaded instead of the standard library without user knowledge. This is why I would prefer to fix it.