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

set deep copy doesn't perform a deep copy #1406

Closed
tsandall opened this issue May 3, 2019 · 0 comments · Fixed by #1408
Closed

set deep copy doesn't perform a deep copy #1406

tsandall opened this issue May 3, 2019 · 0 comments · Fixed by #1408
Labels

Comments

@tsandall
Copy link
Member

tsandall commented May 3, 2019

The set deep copy method doesn't deep copy the elements. Problems manifest in the REPL where queries may be re-compiled. For example:

$ ./opa_linux_amd64 run 
OPA 0.10.8-dev (commit 589105af, built at 2019-05-03T15:12:26Z)

Run 'help' to see a list of commands.

> x := 1; y := {x}
1 error occurred: 1:9: rego_unsafe_var_error: expression is unsafe
@tsandall tsandall added the bug label May 3, 2019
@tsandall tsandall changed the title repl: unexpected safety error on sets containing assigned vars set deep copy doesn't perform a deep copy May 3, 2019
tsandall added a commit to tsandall/opa that referenced this issue May 3, 2019
The deep copy operation was not calling Copy on the set elements. This
manifested in issues in the REPL where parsed queries are retained and
used after the query compile runs. Since the query compile deep copies
the parsed query before mutating it, the REPL's parsed query was
getting corrupted.

Fixes open-policy-agent#1406

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
patrick-east pushed a commit that referenced this issue May 4, 2019
The deep copy operation was not calling Copy on the set elements. This
manifested in issues in the REPL where parsed queries are retained and
used after the query compile runs. Since the query compile deep copies
the parsed query before mutating it, the REPL's parsed query was
getting corrupted.

Fixes #1406

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant