anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: evalf/nutils
Issue: incorrect weights in zipped sample

Let sample `Z` be the zip of two samples `X` and `Y`. It is guaranteed that the order in which `Z` traverses the elements of `X` is monotonic. Not strict monotonic, however: if the points `p` of some element `i` of `X` are divided over `n >= 2` elements of `Y`, then element `i` is evaluated `n` times, each with a different subset `s_j` of points `p` and weights `w`. If the subsets `(s_j)_j` are consecutive slices, `max(s_j) < min(s_{j+1})`, then everything works fine. If not, for the `j`-th evaluation of element `i` points `p[s_j]` is used together with weights `w[t_j]` instead of `w[s_j]`, where `(t_j)_j` is a sequence of consecutive slices such that the sizes of the subsets `s_j` and `t_j` are equal.

Minimal example that triggers the bug:

```python
X, x = mesh.line([1, 5], space='X')
Y, y = mesh.line([0, 3, 4], space='Y')
smpl = X.sample('gauss', 6)
zipped = smpl.zip(Y.locate(y, smpl.eval(x) % 4, tol=1e-10))
zipped.integrate(x * function.J(x)) # returns != 12
```

The third point of `smpl` lies in the second element of `Y`, the other three in the first element of `Y`.

Affected versions:

- [x] master (#792)
- [x] v7 (#799)

Changed files:
nutils/sample.py, tests/test_sample.py

diff --git a/nutils/sample.py b/nutils/sample.py
index 8cc0649d..c5f366f7 100644
--- a/nutils/sample.py
+++ b/nutils/sample.py
@@ -746,8 +746,10 @@ class _Zip(Sample):
         return self._getslice(self._indices, ielem)
 
     def get_evaluable_weights(self, ielem):
-        weights = self._samples[0].get_evaluable_weights(evaluable.Take(self._ielems[0], ielem))
-        return self._getslice(weights, ielem)
+        ielem0 = evaluable.Take(self._ielems[0], ielem)
+        slice0 = self._getslice(self._ilocals[0], ielem)
+        weights = self._samples[0].get_evaluable_weights(ielem0)
+        return evaluable._take(weights, slice0, axis=0)
 
 
 class _TakeElements(_TensorialSample):
diff --git a/tests/test_sample.py b/tests/test_sample.py
index 15796553..768797e3 100644
--- a/tests/test_sample.py
+++ b/tests/test_sample.py
@@ -299,6 +299,21 @@ Zip(etype='square')
 Zip(etype='triangle')
 Zip(etype='mixed')
 
+class ZipCornerCases(TestCase):
+
+    def test_reordered_reference_indices(self):
+        # The first sample in a zip typically maintains the order of the
+        # points. Here we test a situation where this is not true: the third
+        # point of `smpl` is located in the second element of `Y`, the other
+        # three in the first element of `Y`.
+        X, x = mesh.line([1, 5], space='X')
+        Y, y = mesh.line([0, 3, 4], space='Y')
+        smpl = X.sample('gauss', 6)
+        zipped = smpl.zip(Y.locate(y, smpl.eval(x) % 4, tol=1e-10))
+        self.assertAllAlmostEqual(zipped.eval(Y.f_index), [0, 0, 1, 0])
+        # Assert we get the correct weights (issue #791).
+        self.assertAllAlmostEqual(zipped.integrate(x * function.J(x)), 12)
+
 
 class TakeElements(TestCase, Common):
Repository: marechj/hll_rcon_tool
Issue: In mutliple servers mode services don't restart on error

From server 2 to 4, the docker compose config only restarts the service `on-failure` which is done on purpose to that if the stack does not have config for server N it just stops quietly.

However there must be a bug in the entrypoint that causes the main process to return as sucessful even when the python cause crashed from uncaught exception. 
Find a way for the entrypoint.sh script to return the proper error code (but not if it's just cause server N is not configured)


Changed files:
rcon/game_logs.py, manage.py

diff --git a/manage.py b/manage.py
index d9c44ce..69f6129 100755
--- a/manage.py
+++ b/manage.py
@@ -56,4 +56,6 @@ if __name__ == "__main__":
     finally:
         if os.getenv("IS_OPTIONNAL_SERVER") == "yes":
             exit(0)
+        else:
+            exit(1)
         
diff --git a/rcon/game_logs.py b/rcon/game_logs.py
index 3efebb2..b86743d 100644
--- a/rcon/game_logs.py
+++ b/rcon/game_logs.py
@@ -77,7 +77,7 @@ def event_loop(replay=False):
             for action_hook, funcs in HOOKS.items():
                 if log['action'].startswith(action_hook):
                     hooks += funcs
-
+            
             for hook in hooks:
                 try:
                     logger.info("Triggered %s.%s on %s", hook.__module__, hook.__name__, log['raw'])