Skip to content

Commit

Permalink
matcher: check for exponent base of 1
Browse files Browse the repository at this point in the history
Problem: in a resource range, if min is 1 when the operator is '^' then
the code gets stuck in an infinite loop

Add a check if exponent base is 1, and return current value if so (same
behaviour as if exponent or multiplication operand is 1)
  • Loading branch information
sam-maloney committed Feb 14, 2025
1 parent da6156a commit de93f15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion resource/policies/base/matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ unsigned int matcher_util_api_t::calc_count (const Flux::Jobspec::Resource &reso
}
break;
case '^':
if (resource.count.operand < 2)
if (resource.count.operand < 2 || cur == 1)
count = cur;
else {
while (cur <= qc && cur <= resource.count.max) {
Expand Down

0 comments on commit de93f15

Please sign in to comment.