Skip to content

fix: compare PLEX_UPDATE_CHANNEL numerically - #181

Open
lbellows wants to merge 1 commit into
plexinc:masterfrom
lbellows:fix/update-channel-test
Open

fix: compare PLEX_UPDATE_CHANNEL numerically#181
lbellows wants to merge 1 commit into
plexinc:masterfrom
lbellows:fix/update-channel-test

Conversation

@lbellows

Copy link
Copy Markdown

Summary

[ "${PLEX_UPDATE_CHANNEL}" > 0 ] is a redirect, not a comparison. When the variable is set it created a file named 0 in the working directory and treated any non-empty value as true.

Use a numeric -gt test (non-numeric values fail closed) and quote PLEX_CLAIM_FILE when reading the claim token.

Test plan

  • bash -n root/plex-common.sh root/etc/cont-init.d/40-plex-first-run
  • Reproduced the old [ > 0 ] creating a file named 0
  • New -gt accepts 16, rejects 0, fails closed on non-numeric, and does not create 0
  • PLEX_CLAIM_FILE is quoted

The previous test used '>' inside '[ ]', which redirects to a file
named 0 instead of comparing integers. Quote PLEX_CLAIM_FILE when
reading the claim token.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants