fix: sc upgrade crashes with syntax error for existing installs#342
Merged
Conversation
…mber empty args
push.yaml line 637 used single-quoted sed, so `${VERSION}` was written
literally into sc.sh instead of being expanded to the actual release tag.
Result: every downloaded sc.sh had `VERSION="${VERSION}"` → empty at
runtime → `semver_compare "" "$CURRENT"` → `$((2026 - ))` syntax error
for any user who already had sc installed (sc upgrade / curl | bash).
Root-cause fix (push.yaml): switch to double-quoted sed so the CI env var
expands before the sed script is built.
Belt-and-suspenders fix (sc.sh):
- compareNumber: guard one-empty-arg cases (previously only both-empty)
- version-compare block: skip semver_compare when VERSION is empty rather
than crashing; empty VERSION = no specific target = always fetch latest
Signed-off-by: Dmitrii Creed <creeed22@gmail.com>
Cre-eD
requested review from
Laboratory,
smecsia and
universe-ops
as code owners
June 24, 2026 18:53
3 tasks
Semgrep Scan ResultsRepository:
Scanned at 2026-06-25 07:56 UTC |
Security Scan ResultsRepository:
Scanned at 2026-06-25 07:56 UTC |
📊 Statement coverageMeasured on the documented included set (see
Baseline: |
smecsia
approved these changes
Jun 25, 2026
universe-ops
approved these changes
Jun 25, 2026
smecsia
approved these changes
Jun 25, 2026
universe-ops
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
push.yamlline 637 used a single-quotedsedscript:sed -i -e 's/VERSION="0\.0\.0"/VERSION="${VERSION}"/g' ...Single quotes suppress shell expansion, so the literal string
${VERSION}was written into every distributedsc.sh. At runtime (user's shell),$VERSIONis unset →VERSION="". Then:Broke everyone doing
sc upgradeorcurl … | bashwho already had sc installed.Changes
push.yaml— switch to double-quoted sed so the CI env var expands at build time:sed -i -e "s/VERSION=\"0\\.0\\.0\"/VERSION=\"${VERSION}\"/" ...sc.sh— two belt-and-suspenders guards so the script never crashes even ifVERSIONis empty for any other reason:compareNumber: handle one-empty-arg cases (was only guarding both-empty)semver_comparewhenVERSIONis empty; an empty target version means "fetch latest", so the defaultVERSION_COMPARE="1"is correctTest plan
curl -s https://dist.simple-container.com/sc.sh | grep ^VERSION=should show the baked version, not${VERSION}sc upgradeon an already-installed sc completes without syntax errorCloses #341