You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] [ / test integer operators read an empty or non-numeric operand as 0 ([ "" -lt 3 ] is true) #334
Same as bash: an error on stderr and status 2, so the condition is not taken.
bash: line 1: [: : integer expression expected
rc=2
bash: line 1: [: abc: integer expression expected
rc=2
Actual Behavior
Both print rc=0 with nothing on stderr. The operand is read as 0, so the test is true.
Additional Context
Found while reviewing #332. It is not caused by that PR: both commands give rc=0 on its base 55d7816. That PR does widen the reach, because a quoted unset variable is now kept as an empty operand instead of being dropped:
unset n;while [ "$n"-lt 2 ];doecho"loop [$n]"; n=$((n+1));done;echo end
Returning an error for an operand that does not parse, and having test report it with status 2, would match bash. That is the same status-2 path #321 asks for when an operand is missing. I have not written or tested a fix.
Activity
test: pin more strands-agents#334 integer operand cases, including a …