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

expression: deep copy the string when assigning it to a user variable #11041

Merged
merged 2 commits into from
Jul 3, 2019

Conversation

zz-jason
Copy link
Member

@zz-jason zz-jason commented Jul 2, 2019

Signed-off-by: Zhang Jian zjsariel@gmail.com

What problem does this PR solve?

At present, the builtin SetVar function might refer to the content of an underlying Chunk. The problem is, when the content of that Chunk is changed, the value of the corresponding user variable is changed as well.

What is changed and how it works?

To address this issue, we should make a deep copy of that string value before assigning it to a user variable.

Check List

Tests

  • Unit test

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note

Signed-off-by: Zhang Jian <zjsariel@gmail.com>
@zz-jason zz-jason added type/bugfix This PR fixes a bug. priority/release-blocker This issue blocks a release. Please solve it ASAP. component/expression labels Jul 2, 2019
@zz-jason zz-jason changed the title expression: deep copy the string when setting user variable from Chunk expression: deep copy the string when assigning it to a user variable Jul 2, 2019
@zz-jason
Copy link
Member Author

zz-jason commented Jul 2, 2019

/run-all-tests

@zz-jason zz-jason requested review from XuHuaiyu and qw4990 July 2, 2019 16:57
@codecov
Copy link

codecov bot commented Jul 2, 2019

Codecov Report

Merging #11041 into master will decrease coverage by 0.0217%.
The diff coverage is 100%.

@@               Coverage Diff                @@
##             master     #11041        +/-   ##
================================================
- Coverage   80.9612%   80.9394%   -0.0218%     
================================================
  Files           419        419                
  Lines         89302      89305         +3     
================================================
- Hits          72300      72283        -17     
- Misses        11769      11784        +15     
- Partials       5233       5238         +5

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

LGTM

@XuHuaiyu XuHuaiyu added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 3, 2019
Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression priority/release-blocker This issue blocks a release. Please solve it ASAP. status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants