-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[servicebus, eventhubs] Potential bug because of modifying the list during iteration #26765
Comments
Thank you for opening this issue, we will look into it. |
The code is introduced by #25792 |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Saglodha. Issue DetailsDescribe the bug for i in ip_rule:
for j in ip_rule_list:
if i['ip-address'] == j["ip_mask"]:
ip_rule_list.remove(j)
a = [1,2,3,4]
for i in a:
print(i)
a.remove(i)
>>> 1
>>> 3 There are four parts contains similar logic. Related PR: #26685, found by
|
Hey @bebound , Since IP address in Ip-rule is unique. So Suppose if it matches it will remove that ip address in ongoing iteration. even if skip the next index it doesn't harm bcs unique ip is already remove. So next iteration again it starts from 0th index of IP_RULE_list. |
Thanks for your confirmation. |
yes, you can use. |
Describe the bug
In https://github.com/azure/azure-cli/blob/ae4a96ad73e6e6b4cd27b29ade5cbe65e62dadf0/src/azure-cli/azure/cli/command_modules/eventhubs/operations/network_rule_set.py#L64-L67
ip_rule_list
is not fully iterated if j is removed. For example:There are four parts contains similar logic.
Related PR: #26685, found by
modified-iterating-list
rule.The text was updated successfully, but these errors were encountered: