cpm icon indicating copy to clipboard operation
cpm copied to clipboard

Fail to install a module when the same filename is present

Open ferki opened this issue 3 years ago • 5 comments
trafficstars

cpm fails when trying to install a module with a name matching a file name (or directory name) in the current directory:

FAIL install file:///path/to/project/lib

and the build.log complains about:

[...] Distribution does not have META.json nor META.yml

This for example happens when a project has both a lib directory and the lib module as a dependency, then trying to use e.g. dzil listdeps | cpm install - to install all dependencies. In that case dzil returns lib as a dependency and it conflicts with the lib directory.

Before #161 and #216, core dependencies should have been filtered out in one way or another before passing the dependency list to cpm, so that masked this behavior at least for my use cases. I tried dzil listdeps --omit-core and cpm install --target-perl, but that didn't seem to help.

I could also reproduce the same failure by trying to install any other module with a name that conflicts with a directory or file name in the current directory.

It looks like a real bug, but I wonder if I might have missed some of the available options that might help here? :thinking:

ferki avatar Apr 17 '22 17:04 ferki

For the meanwhile, you can try

dzil listdeps --omit-core=5.008001

skaji avatar Apr 18 '22 11:04 skaji

Related to https://github.com/miyagawa/cpanminus/issues/564

skaji avatar Apr 18 '22 11:04 skaji

For the meanwhile, you can try

dzil listdeps --omit-core=5.008001

Ah, thanks for the example! I did try dzil listdeps --omit-core=5.34.1, but that did not work. I confirm omitting with a different version format helps working around the core module problem with e.g. dzil listdeps --omit-core=5.034001.

Related to miyagawa/cpanminus#564

Thanks for the reference as well! I did not realize cpanm was affected by this naming conflict some time ago :thinking: It seems to be fixed in cpanm by now (using version 1.7044), though: cpanm lib finishes successfully with lib is up to date. (0.65).

ferki avatar Apr 18 '22 14:04 ferki

If the lib is not a local directory, but a local file, then cpanm lib will fail.

skaji avatar Apr 19 '22 00:04 skaji

Right, confirmed. Looks like I just got "lucky" with lib being the only conflict for my use cases, and it's a directory. Thank you, I learned something already!

ferki avatar Apr 19 '22 07:04 ferki