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

corelist behaving weirdly when a module name starts with a hyphen #16809

Open
p5pRT opened this issue Jan 12, 2019 · 7 comments
Open

corelist behaving weirdly when a module name starts with a hyphen #16809

p5pRT opened this issue Jan 12, 2019 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Jan 12, 2019

Migrated from rt.perl.org#133766 (status was 'open')

Searchable as RT133766$

@p5pRT
Copy link
Author

p5pRT commented Jan 12, 2019

From @xenu

If you pass anything starting with a hyphen as a module name, corelist
will think that it was added in perl 5.8.9​:

% corelist -a -- -anything-starting-with-a-hyphen

Data for 2018-12-18
-anything-starting-with-a-hyphen was first released with perl v5.8.9

@p5pRT
Copy link
Author

p5pRT commented Jan 15, 2019

From @jkeenan

On Sat, 12 Jan 2019 18​:38​:48 GMT, me@​xenu.pl wrote​:

If you pass anything starting with a hyphen as a module name, corelist
will think that it was added in perl 5.8.9​:

% corelist -a -- -anything-starting-with-a-hyphen

Data for 2018-12-18
-anything-starting-with-a-hyphen was first released with perl v5.8.9

When I simply type​:

#####
$ corelist -a --
#####

... I get the Usage statement, just as I would if I had typed 'corelist -h'.

That leads me to believe that 'corelist' is interpreting '-a --' as a mistake and defaulting to the Usage statement.

It probably should quit right there, but it apparently continues to parse command-line arguments. To get the weird behavior reported by xenu, I have to say '-a -- -<module_name>', e.g.,

#####
$ corelist -a -- -List​::Compare

Data for 2018-06-22
-List​::Compare was first released with perl v5.8.9

#####

So my hunch is that 'corelist -a' needs to be modified to be stricter with respect to what additional arguments it accepts.

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jan 15, 2019

The RT System itself - Status changed from 'new' to 'open'

@ilmari
Copy link
Member

ilmari commented Apr 9, 2020

This is because first_release() (like all the other Module::CoreList functions) can be called either as a method or a function, and it only shifts off the invocant if the second argument is a valid module name, which - isn't. So Module::CoreList->first_release('-') gets interpreted as Module::CoreList::first_release('Module::CoreList', '-'), and since - sorts before numers, it shows the first release Module::CoreList was in, which was 5.8.9.

The simplest fix would be to make corelist call the Module::CoreList functions as functions, rather than methods.

@karenetheridge
Copy link
Member

What do you intend Module::CoreList->first_release('-') to do, since - isn't a valid module name?

ilmari added a commit that referenced this issue Apr 9, 2020
Module::CoreList functions can be called either as methods or
function, and several of them only shift off the invocant if the
second argument is a valid module name, isn't.  This means that
`Module::CoreList->first_release($not_a_module)` gets interpreted as
`Module::CoreList::first_release('Module::CoreList', $not_a_module)`,
and so reports whichever perl release had Module::CoreList with
`$VERSION ge $not_a_module`.

Fixes #16809.
@Grinnz
Copy link
Contributor

Grinnz commented Apr 9, 2020

It should have the same result as when called with a module that isn't in core (empty list).

@ilmari
Copy link
Member

ilmari commented Apr 9, 2020

@karenetheridge I'm not proposing to change the Module::CoreList API here, just the corelist command.
The API is a confused mess originating in the misguided commit 0dee1c2 and exacerbated by 6d7c3a1.

@xenu xenu removed the Severity Low label Dec 29, 2021
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

5 participants