Perl-Toolchain-Gang / Module-Metadata

Gather package and POD information from perl module files
http://metacpan.org/release/Module-Metadata/
Other
8 stars 16 forks source link

Inconsistent file paths generated by provides #36

Open Grinnz opened 3 years ago

Grinnz commented 3 years ago

The provides field in the CPAN meta spec specifies that "It must contain a Unix-style relative file path".

However, package_versions_from_directory returns the native file path returned by File::Find canonicalized to the current OS by File::Spec: https://metacpan.org/source/ETHER/Module-Metadata-1.000037/lib/Module/Metadata.pm#L263

This path is then appended to the prefix with a unix-style slash unconditionally by the provides method, but the rest of the path will keep its OS-dependent path separators. Thus on a Windows system you get paths like lib/Foo\Bar.pm.

This method is currently used at least by Minilla in generating the provides metadata. Ref https://github.com/metacpan/metacpan-web/issues/2306

neilb commented 3 years ago

This (provides including a broken path due to a mix of unix and windows style path separators) caused a slightly confusing situation where a dist was added to the CPAN Index, but then not indexed by MetaCPAN.

Here's the offending line:

"file" : "lib/Data\\QuickMemoPlus\\Reader.pm",