madecoste / swarming

Automatically exported from code.google.com/p/swarming
Apache License 2.0
0 stars 1 forks source link

Operator "or" does not work correctly in .isolate conditionals #211

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've been trying to find out why some of the changes in this patch have no 
effect:

https://codereview.chromium.org/895923002/patch/70001/80001

Turns out operator "or" is broken. Suppose asan is 0 and msan is 1. Then:
"msan==1 or asan==1" evaluates to true
"asan==1 or msan==1" evaluates to false 

Original issue reported on code.google.com by earth...@chromium.org on 5 Feb 2015 at 3:39

GoogleCodeExporter commented 9 years ago
Let us consider the expression "asan=1 or msan==1" as we run it through 
match_configs() in isolate_format.py. The possible combinations are: (1, 1), 
(1, None), (None, 1), (None, None).

Obviously (1, 1) is accepted and (None, None) is discarded.
(None, 1) is discarded because 'asan' is unbound (eval() throws an exception).
(1, None) is accepted because eval() short-circuits and returns true after 
evaluating 'asan==1'.

So the acceptable configurations are [(1, 1), (1, None)]. We actual 
configuration we see is [(0, 1)] which doesn't match either of those.

The fundamental problem is that we only possible values we consider are those 
that actually appear in the .isolate file. I can work around this issue by 
including an empty conditional with 'asan=0 or msan=0" elsewhere in the file.

Original comment by earth...@chromium.org on 5 Feb 2015 at 5:22

GoogleCodeExporter commented 9 years ago

Original comment by maruel@chromium.org on 9 Feb 2015 at 7:18