[repo] Fix octal-parsing crash in validate.sh version comparison#193
Merged
Conversation
Bash arithmetic treats zero-padded segments (e.g. 08, 09) as octal, which is invalid and aborts the script under set -e. Force base-10 with 10# so version bumps like 0.2.08 no longer fail CI (see PR Dispatcharr#192).
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.
What's wrong
Plugin PR #192 (epgeditarr bump to v0.2.08) failed validate-plugin CI with:
version_greater_than() splits a semver string on "." and compares the segments
with bash ((...)) arithmetic. Bash treats any numeric string with a leading 0
as octal, and 08/09 aren't valid octal digits, so the script aborts (the file
has set -e). Any plugin version with a zero-padded segment ending in 8 or 9,
such as 0.2.08 or 1.09.0, trips this. It isn't specific to epgeditarr.
Fix
Force base-10 interpretation with the 10# prefix on every arithmetic comparison
in version_greater_than(). No other changes needed. validate_semver and
validate_dispatcharr_version only do regex matching, not arithmetic.