Conversation
|
@aminvakil apparently, EDIT; nevermind I just read this #4489 (comment), sorry about that |
|
Just dropping this here: #3878 (review) Overall, I think this is pretty good but we need a shared place and format to have the hard-stops so docs and the repo does not diverge. I'd propose JSON in a well-known location like the docs repo or this repo, and reading it with |
@BYK Yeah I remember about your comment. I don't know where the "shared place" should be. I don't want to have it on And yes, there will always be a maintenance burden for this one. |
Not sure we are on the same page. My proposal is having this information in a separate, dedicated JSON file in this repo and then the docs repo fetching it at build time. |
Aaaaaahhhhhh, that makes sense. I dunno how to do it on the docs repo, but making a JSON file here would be doable. |
| if [[ -n "$current_version" ]]; then | ||
| # We iterate over the list of hard stops, and check whether the current | ||
| # version is below any of them. | ||
| local _wrote_version=0 |
There was a problem hiding this comment.
Top-level local crashes upgrade installs
High Severity
local _wrote_version=0 runs at script scope in a sourced file, which bash rejects. Combined with set -e in install.sh, any upgrade that already has a tracking file aborts immediately, so the hard-stop check never runs and the install cleanup trap can stop a live stack.
Reviewed by Cursor Bugbot for commit 2b942d2. Configure here.
The idea came from Discord, and Alex (stayalive) lay out a very good approach on this: https://discord.com/channels/621778831602221064/796028405833007104/1541789134006259814
9b35c7d to
2472e2c
Compare
| if ((arr1[0] > arr2[0])); then | ||
| return 1 | ||
| elif ((arr1[0] < arr2[0])); then | ||
| return -1 |
There was a problem hiding this comment.
Bug: The compare_calver function's result is captured from stdout, but it returns a value via exit code. This causes compare_result to be empty, leading to an upgrade script failure.
Severity: CRITICAL
Suggested Fix
Modify the compare_calver function to echo its result to standard output instead of using return. Alternatively, change the calling code to capture the exit code using $? immediately after the function call: compare_calver "..." "..."; compare_result=$?. If capturing the exit code, be aware that return -1 becomes exit code 255 in bash, so the function's return values and the caller's checks must be adjusted to use valid exit codes (0-255).
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: install/check-hard-stop.sh#L74
Potential issue: The `compare_calver` function is designed to communicate its result via
an exit code (`return`), but the calling code captures its standard output into the
`compare_result` variable. Since the function does not write its result to stdout,
`compare_result` is always an empty string. This causes the subsequent conditional
checks to fail, leading the script to always execute the `else` block and exit with an
error. This bug triggers during the common upgrade scenario for existing installations,
causing the install script to fail.
Also affects:
install/check-hard-stop.sh:80~80install/check-hard-stop.sh:86~86install/check-hard-stop.sh:160~161
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2472e2c. Configure here.
| fi | ||
|
|
||
| return 0 # Equal | ||
| } |
There was a problem hiding this comment.
Compare result never reaches caller
High Severity
compare_calver reports its result via return, but the caller stores stdout in compare_result. The function never prints that value, so compare_result is always empty and every upgrade aborts on the unexpected-value path. return -1 is also not a valid bash status.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2472e2c. Configure here.


The idea came from Discord, and Alex (stayalive) lay out a very good approach on this: https://discord.com/channels/621778831602221064/796028405833007104/1541789134006259814