Perl-Toolchain-Gang / CPAN-Meta

Specifications for CPAN distribution META files
37 stars 40 forks source link

Add check for content prior to filename #129

Open ssoriche opened 7 years ago

ssoriche commented 7 years ago

Using the existing file parsing and comparisons, add checking of the META content to determine data markup prior to using the filename. These changes alleviate an issue that occurs when the content and extension do not match

karenetheridge commented 7 years ago

We could also potentially simply error on cases like these, but would that change in behaviour be too unacceptable for things that already exist in the wild?

ssoriche commented 7 years ago

The example module does install when using cpanm and carton install, however fails when being installed with carton install --deployment because carton doesn't have the module details to populate the snapshot file. As the example was released in 2009, it may not be a very wide spread issue. My worry is the time to get the original fixed versus Parse::CPAN::Meta checking the content of the file instead of relying solely on the filename and doing the right thing.

However what I've submitted doesn't change the underlying code, the file was always read into a variable for parsing, it's just now the content of the file is used to determine what to use for parsing rather than the file extension.

ssoriche commented 7 years ago

I am going to amend this pull request to including printing a warning when the filename and content do not match, and continue the installation.

haarg commented 7 years ago

This feels more like a carton bug to me. Dists like this should be treated as the same as dists without metadata, which carton should be fixed to accommodate if it doesn't.

skaji commented 7 years ago

I don't think Parse::CPAN::Meta should accept meta files whose filenames does not match their contents.