Skip to content

fix: Configure-Xcode-Simulators duplicate removal logic#13836

Open
PrashantRaj18198 wants to merge 1 commit intoactions:mainfrom
WarpBuilds:main
Open

fix: Configure-Xcode-Simulators duplicate removal logic#13836
PrashantRaj18198 wants to merge 1 commit intoactions:mainfrom
WarpBuilds:main

Conversation

@PrashantRaj18198
Copy link
Copy Markdown

@PrashantRaj18198 PrashantRaj18198 commented Mar 24, 2026

Description

Bug fix -- configure xcode simulators sometimes leaves duplicate entries

There is a case where some duplicate xcode simulators are being missed.

Case:

Here A and B are simulators and the numeric values are time.

Initial array:
[ A:0, A:1, A:2, B:0, B:1 ]

Index:
  0    1    2    3    4

Pass 1:
i = 0
   v
[ A:0, A:1, A:2, B:0, B:1 ]
  ^    ^
  |    |
  |    +-- compare with A:1 -> same simulator kind as A:0
  +------- current item A:0

Action:
- remove A:1

Array becomes:
[ A:0, A:2, B:0, B:1 ]

New index layout:
  0    1    2    3

Problem in old logic:
- after removal, loop still increments i
- so i becomes 1

Pass 2:
i = 1
        v
[ A:0, A:2, B:0, B:1 ]
  0    1    2    3

Now we are at:
       ^
       |
       +-- A:2

So the comparison is now effectively:
A:2 vs B:0

That is fine, but:

[ A:0, A:2, B:0, B:1 ]
  ^    ^
  |    |
  |    +-- still another A remains
  +------- original A still present

So we skipped re-checking index 0 against the new shifted value A:2.

The updated code basically updates i only if no simulator matches were found.

We can close this PR and do the co-author thing since this is a macos contribution
For new tools, please provide total size and installation time.

Related issue:

Check list

  • Related issue / work item is attached
  • Tests are written (if applicable)
  • Documentation is updated (if applicable)
  • Changes are tested and related VM images are successfully generated
There is a case where some duplicate xcode simulators are being missed.

Case:

Here A and B are simulators and the numeric values are time.

[ A:0, A:1, A:2, B:0, B:1 ]

Current, case i=0, compares A:0, A:1 and removes A:1, array now
[ A:0, A:2, B:0, B:1 ]. But we also increment i at the end of the loop
so i moves to 1.

i=1, checks A:2 againsts B:0 which is ok. But multiple simulators for A
are still present.

The updated code basically updates i only if no simulator matches were found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant