Skip to content

Conversation

@anmenaga
Copy link

This fixes issue #2607.
'RequiredModules' is a field in module manifest that can reference other modules using ModuleSpecification format.
The basic version of this format (just module name) was working fine, however there was a problem when more detailed version of the format was used (the one that uses module versions or/and GUIDs).
During module import, there is a check for cyclic references through 'RequiredModules' field. The bug was in this check for cyclic references , related to comparison rules for ModuleSpecification objects - as a result code was incorrectly reporting 'cyclic reference' error in cases when there was none.

Added tests for different ModuleSpecification formats and a test for error when there is actually a cyclic reference.

Test results before the fix:
requiredmodulefix_before

Test results after the fix:
requiredmodulefix_after

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does requiredModuleSpecification only needs to be added when currentModule is not null?
this is confusing here. if so, please add comment explains why

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I was thinking that both addition should be bundled together; but thinking more about it - it is better to move the new addition to its own 'if' check. Updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also check that the module is actually loaded.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point; updated.

@anmenaga anmenaga force-pushed the FixedModuleSpecSyntaxInRequiredModules branch from 5fc877d to bad1221 Compare April 28, 2017 17:57
@chunqingchen
Copy link
Contributor

good to sign off

@daxian-dbw daxian-dbw merged commit c0aafdb into PowerShell:master May 1, 2017
@anmenaga anmenaga deleted the FixedModuleSpecSyntaxInRequiredModules branch October 31, 2018 21:20
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

Successfully merging this pull request may close these issues.

4 participants