Commit 0d91eaa
fix(scripts): correct bash-3.2 comment's stated mechanism in bump-objectui.sh (#12306)
The bash-3.2 note explaining why the ref-collection loop uses `if [[ -n "$x" ]]; then …; fi`
rather than a trailing `[[ … ]] && …` attributed the trap to the empty-list case. Measured
on bash 5.2.21, that does not reproduce: an all-empty read leaves the loop body unexecuted
and the `while` exits 0. The real trap is a non-empty read whose last line fails the test,
and only once that loop is the last command of a function — the `&&`-list's false status
becomes the loop's exit status, becomes the function's return, and `set -e` kills the
caller on that. Measured over all four combinations (empty vs. non-empty-with-failing-last-
line × loop-is-fn's-last-command vs. not): only that one combination exits 1; the other
three exit 0.
The `if` form itself is unchanged and correct — only the stated reason was wrong.
Fixes #12222
Claude-Session: https://claude.ai/code/session_af22b339-91b5-5814-8b9b-2453fc5b3f68
Co-authored-by: Claude <noreply@anthropic.com>1 parent c463ec3 commit 0d91eaa
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | | - | |
343 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
344 | 351 | | |
345 | 352 | | |
346 | 353 | | |
| |||
0 commit comments