Resolve #2754 and #16300 - introduce a workaround for Module::Install::DSL and fixup return code for perl_parser()#20181
Merged
Merged
Conversation
This converts INIT {} blocks from the Module::Install::DSL
namespace into BEGIN blocks. This works around the bug reported in
GH Issue #16300. (Hopefully, not fully tested yet.) Which in turn
should allow us to close the bug in #2754.
See also PR: #20168 and Issue: #20161 both of which are blocked by
this.
This reverts commit 857320c. There were a lot of conflicts due to whitespace changes in the intervening time. I manually reviewed the differences and merged them.
e7d9ff9 to
c412761
Compare
Collaborator
Author
|
Turns this touches on other reverted logic from what i can tell. The last two commits are related to Win32 issues. See #16418 |
tonycoz
approved these changes
Aug 31, 2022
Collaborator
Author
|
I will merge this as is, if and when the MI workaround is no longer needed we can remove it. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In 0301e89 Zefram fixed a long standing bug #2754, and properly defined the exit code from perl_parse(). This however broke Module::Install::DSL as can be seen in issue #16300. The patch was reverted in 857320c. Module::Install is not easily upgradable due to its design, and there are still a lot of modules out there with the buggy use of INIT.
However, it turns out that the bugfix from #2754 allows us to fix other issues which we want to address.
So this PR reverts Zeframs revert and creates a simple workaround for the Module::Install::DSL issue. INIT blocks in the Module::Install::DSL namespace will magically be treated as BEGIN blocks. This means that they will be executed inside of the eval that Module::Install::DSL creates, and executed as expected, at the same time a warning is produced to show the workaround has been triggered.
The check for this is quite efficient so it should not be noticeable outside of the special case it is meant to work around.
This will enable us to fix Issue: #20161 and potentially also apply PR #20168