-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
feat: print all locals errors when there is a circular error #11527
Conversation
|
||
// 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++ { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
packer/hcl2template/types.packer_config.go
Line 189 in 91a0f97
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.
There was a problem hiding this 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
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.
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. |
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