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

feat: print all locals errors when there is a circular error #11527

Merged
merged 1 commit into from
Jan 27, 2022
Merged

feat: print all locals errors when there is a circular error #11527

merged 1 commit into from
Jan 27, 2022

Conversation

teddylear
Copy link
Contributor

feat: print all locals errors when there is a circular error

Updated with a test in current test suite. However not sure how to validate all output as that is not currently in the test suite, just that an error occurred during validation. If you have any ideas on how I should add that, please let me know

#11397

@teddylear teddylear requested a review from a team as a code owner January 26, 2022 00:56

// divide by 2 so that you don't get duplicate locals
// appear to have double locals in LocalBlock, not sure if intentional
for i := 0; i < len(locals)/2; i++ {
Copy link
Contributor

Choose a reason for hiding this comment

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

eh nice fix and nice finding, these duplicate values should not be duplicate, I'll try to find the root cause.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ill keep taking a look too, was surprising when debugging. Even without the duplicates though, I think something like this is required to print all local errors if there is a circular error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Found the root cause, it's hapenning here:

We first copy this value:

locals := c.LocalBlocks

Then return it, but the returned value is also added to that c.LocalBlocks slice, it was introduced here: #10509

Okay, but I think yours is good to go, and I'll fix the duplicate block issue right up next.

Copy link
Contributor

@azr azr left a comment

Choose a reason for hiding this comment

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

Thanks for your time. Will fix that divide by two thing in a follow up PR

@azr azr merged commit 1d01ad3 into hashicorp:master Jan 27, 2022
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Feb 5, 2022
NOTES:

This patch release fixes a crash in m1 caused by the psutils dep,
hashicorp/packer#11546, originally reported by the
HomeBrew team here hashicorp/packer#11512
IMPROVEMENTS

* Print all locals errors when there is a circular
error. [GH-11527](hashicorp/packer#11527

BUG FIXES

* Prevent duplicate local block creation.
* Update psutils dep to avoid crash on Arm64 Macs.
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants