This repository was archived by the owner on Jan 30, 2020. It is now read-only.
*: fixed broken template and metadata#1520
Merged
jonboulle merged 4 commits intocoreos:masterfrom Mar 31, 2016
Merged
Conversation
Contributor
|
Great catch, and gross. |
2d2f4f0 to
bbea486
Compare
Contributor
Author
|
Added test and it has failed. Now, let's apply the fix... |
416ac85 to
1c96e6a
Compare
Contributor
Author
|
@jonboulle done |
job/job.go
Outdated
| values[i] = unitPrintf(v, *uni) | ||
| processedValues := make([]string, len(values)) | ||
|
|
||
| for i, v := range values { |
Contributor
There was a problem hiding this comment.
@kayrus thanks for the catch! you can put this inside the same previous loop:
if uni != nil { processedvalues := make() for ... { ...} requirements[key] = processedvalues } else { requirements[key] = values }
Otherwise it's ok too!
Contributor
|
@kayrus perhaps also improve the commit log of the 4th patch (the fix), same wording as for this PR ? otherwise lgtm. Thank you! |
1c96e6a to
0a13c7b
Compare
Resolves coreos#1514 The problem was caused by the [code optimization](coreos#1376). Before that each unit was stored in its own variable. Then this code was optimized and units became stored in hash map (`getAllUnitsHashMap`). Each hash was assigned to the unit's pointer. And when template unit was checked by `requirements()` function, its content was modified by `values[i] = unitPrintf(v, *uni)` code. Once templated unit was modified, all related units (which have same hash) were modified too, because they are related to one pointer.
0a13c7b to
a23ce6f
Compare
Contributor
|
@jonboulle lgtm, thanks! |
Contributor
Contributor
Author
|
@jonboulle I suppose we have to show that the issue is covered by tests, and then fix it. so from my point of view the commit order is fine |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Resolves #1514
The problem was caused by the code optimization. Before that each unit was stored in its own variable. Then this code was optimized and units became stored in hash map (
getAllUnitsHashMap). Each hash was assigned to the unit's pointer. And when template unit was checked byrequirements()function, its content was modified byvalues[i] = unitPrintf(v, *uni)code. Once templated unit was modified, all related units (which have same hash) were modified too, because they are related to one pointer.Now we don't modify source contents.