Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-1882

Regression in `Set::assign_difference` in Core 13.23.4

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Latest Core release seems to have a regression in Set::assign_difference when using binary data - when the target collection contains [ 1, 1, 1, 1, 1 ], [ 2, 2, 2, 2, 2 ] and the rhs collection contains [ 255, 255, 255, 255, 255 ], [ 1, 1, 1, 1, 1], [ 3, 3, 3, 3, 3 ], [ 2, 2, 2, 2, 2], the result appears to be [ 1, 1, 1, 1, 1], [ 2, 2, 2, 2, 2 ] rather than an empty collection. Note that other values seem to work - here are the .NET results:

        ✔️ RealmSet_WhenManaged_Binary(Byte[]: {<1>,<2>,<3>} - {<4>,<5>,<6>})
        ✔️ RealmSet_WhenManaged_Binary(Byte[]: {<1>,<2>,<3>} - {<1>,<2>,<3>})
        ✔️ RealmSet_WhenManaged_Binary(Byte[]: {<255>} - {<0>})
        ✔️ RealmSet_WhenManaged_Binary(Byte[]: {<0>,<1>,<255>} - {})
        ✔️ RealmSet_WhenManaged_Binary(Byte[]: {} - {<0>})
        ❌ RealmSet_WhenManaged_Binary(Byte[]: {<1>,<2>} - {<255>,<1>,<2>,<3>,<2>})
      	  Expected: equivalent to <empty>
      	  But was:  < < 1, 1, 1, 1, 1 >, < 2, 2, 2, 2, 2 > >
      	  Extra (2): < < 1, 1, 1, 1, 1 >, < 2, 2, 2, 2, 2 > >
      	
        ✔️ RealmSet_WhenManaged_Binary(Byte[]: {<1>,<1>,<1>,<1>,<1>,<1>,<1>} - {<1>,<1>})
        ✔️ RealmSet_WhenManaged_Binary(Byte[]: {<1>,<1>,<1>,<1>,<1>,<1>,<1>} - {<1>,<2>})
        ✔️ RealmSet_WhenManaged_Binary(Byte[]: {<1>,<1>,<1>,<1>,<2>,<2>} - {<1>,<1>})
      

      Where <x> means [ x, x, x, x, x ] and the values before the - are added to the target collection while the values after it are added to the rhs collection (which is also a Set). The issue doesn't appear to happen with other data types either.

      Not sure if it's related to https://github.com/realm/realm-core/issues/7134, but both issues occurred after upgrading Core. This one reproduces on all platforms though, so might be unrelated.

            Assignee:
            thomas.goyne@mongodb.com Thomas Goyne
            Reporter:
            nikola.irinchev@mongodb.com Nikola Irinchev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: