Bug #7100
Updated by Radhika Chippada over 9 years ago
See #6640 for a historical perspective of this issue. In that issue, it was observed that the results of all_projects were different when invoked in different contexts. In note #21 of that issue, Tom added a detailed described (pasted below). It is desirable that we stop reusing the ArvadosResourceList object so that the results are not mangled in various invocations.
(Pasted from note #21 of #6640):
It would be even better to fix the ArvadosResourceList API so the caller doesn't have to remember to dup in cases like this -- i.e., each method like limit() acts more like merge(), returning a new ArvadosResourceList object instead of modifying itself in place -- and it might not even be that hard. If we can't deal with that, I wonder if there is at least a systematic way we can identify similar usage errors that are causing (or likely to cause) similar bugs?
<pre><code class="ruby">
set_a = Fubar.filter [['foo', '=', 'bar']]
set_b = set_a.filter [['baz', '=', 'waz']]
set_c = set_b.limit 5
set_a.each do |x|
puts x
end
# Naturally expected behavior:
# print all results matching foo=bar
# Actual behavior:
# print <= 5 results matching foo=bar && baz=waz
</code></pre>