Skip to content

[Rope] Fix copy-on-write violation in Rope.join#384

Merged
lorentey merged 2 commits intoapple:release/1.1from
lorentey:rope-cow-violation
Jun 3, 2024
Merged

[Rope] Fix copy-on-write violation in Rope.join#384
lorentey merged 2 commits intoapple:release/1.1from
lorentey:rope-cow-violation

Conversation

@lorentey
Copy link
Copy Markdown
Member

@lorentey lorentey commented Jun 1, 2024

Rope.join has a logic error where it fails to properly ensure uniqueness of child node references before zipping the two b-trees together.

rdar://128450202

Checklist

  • I've read the Contribution Guidelines
  • My contributions are licensed under the Swift license.
  • I've followed the coding style of the rest of the project.
  • I've added tests covering all new code paths my change adds to the project (if appropriate).
  • I've added benchmarks covering new functionality (if appropriate).
  • I've verified that my change does not break any existing tests or introduce unexplained benchmark regressions.
  • I've updated the documentation if necessary.

@lorentey lorentey added this to the 1.1.1 milestone Jun 1, 2024
@lorentey lorentey requested a review from jmschonfeld June 1, 2024 00:02
@lorentey
Copy link
Copy Markdown
Member Author

lorentey commented Jun 1, 2024

@swift-ci test

@lorentey
Copy link
Copy Markdown
Member Author

lorentey commented Jun 1, 2024

(Fix not yet pushed; it's coming once the new tests fail as expected on the Linux build.)

Rope.join has a logic error where it fails to properly ensure uniqueness of child node references before zipping the two b-trees together.

rdar://128450202
@lorentey
Copy link
Copy Markdown
Member Author

lorentey commented Jun 1, 2024

Yep:

Test Case 'TestBigString.test_append_copy_on_write' started at 2024-06-01 00:06:00.973
Global seed: 4153508029960133465
/build/swift-collections/Tests/RopeModuleTests/TestBigString.swift:563: error: TestBigString.test_append_copy_on_write : failed - 'false' is not true

Trace:
  - stride: 64
  - i: 137
[...]
Test Case 'TestRope.test_join_copy_on_write' started at 2024-06-01 00:12:33.883
Global seed: 4153508029960133465
/build/swift-collections/Tests/RopeModuleTests/TestRope.swift:474: error: TestRope.test_join_copy_on_write : failed - '[7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904]' does not have equal elements to '[7876, 7877, 7878, 7879, 7880, 7881, 7882, 7883, 7884, 7885, 7886, 7887, 7888, 7889, 7890, 7891, 7892, 7893, 7894, 7895, 7896, 7897, 7898, 7899, 7900, 7901, 7902, 7903, 7904]'
Copy-on-write violation
Trace: (empty)

@lorentey
Copy link
Copy Markdown
Member Author

lorentey commented Jun 1, 2024

@swift-ci test

@lorentey lorentey merged commit 8253d6d into apple:release/1.1 Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants