Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listdeps --cpanm-versions returns the version number not in the documented format #725

Open
abraxxa opened this issue Mar 19, 2024 · 6 comments

Comments

@abraxxa
Copy link

abraxxa commented Mar 19, 2024

This came up in skaji/cpm#245.
https://metacpan.org/pod/cpanm#COMMANDS documents the version without any quoting, https://metacpan.org/pod/CPAN::Meta::Spec neither.
cpm fails if the version is surrounded by quotes as dzil listdeps --cpanm-versions returns.

@karenetheridge
Copy link
Contributor

cpanm does provide one example using quotes, suggesting that quotes are supported everywhere: cpanm Plack~">= 1.0000, < 2.0000"

@karenetheridge
Copy link
Contributor

karenetheridge commented Mar 19, 2024

Two actually: it also says: ...while @ pins the exact version, and is a shortcut for ~"== VERSION".

Does cpm support these two literal examples that cpanm references?

@Grinnz
Copy link
Contributor

Grinnz commented Mar 19, 2024

cpanm's example using quotes is a shell command, and the shell will remove the quotes as part of its parsing; they are in the example because they are required to pass it as a single shell argument.

@karenetheridge
Copy link
Contributor

Interesting, I would have thought that embedded quotes would be preserved by the shell, but indeed they aren't:

perl -MData::Dumper -wle'print "got args ", Dumper(\@ARGV)' cpanm Plack~">= 1.0000, < 2.0000"
got args $VAR1 = [
          'cpanm',
          'Plack~>= 1.0000, < 2.0000'
        ];

So, why isn't cpm also receiving the arguments with the quotes stripped? If the dzil output is piped to cpm just as it is to cpanm, everything should work fine. Is cpm being invoked differently?

@Grinnz
Copy link
Contributor

Grinnz commented Mar 19, 2024

As a point of comparison, in my installdeps command I must form the argument without quotes because it is then quoted as a shell argument, which would preserve the quotes when passed through the shell. https://github.com/Grinnz/Dist-Zilla-App-Command-installdeps/blob/master/lib/Dist/Zilla/App/Command/installdeps.pm#L103

@abraxxa
Copy link
Author

abraxxa commented Mar 22, 2024

So, why isn't cpm also receiving the arguments with the quotes stripped? If the dzil output is piped to cpm just as it is to cpanm, everything should work fine. Is cpm being invoked differently?

When it is piped to xargs the quotes are removed, when piped to cpm - directly they seem to be kept. But in the later case no shell is involved...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants