Harden install and runtime for production use - #7
Merged
Conversation
gifify.sh:
- Fix spinner crash under zsh ("unrecognized modifier 'i'"): the frame
substring now uses arithmetic expansion, which parses correctly in both
bash and zsh. zsh is the default macOS shell where the script is sourced.
- Validate --fps is a positive integer instead of passing bad input through
to ffmpeg and failing mid-encode.
install.sh:
- Verify ffmpeg is on PATH after installing it (a package manager can exit 0
without exposing the binary).
- Enforce ffprobe (used for input analysis; normally bundled with ffmpeg).
- Check for curl before the remote download path, with a clear fallback.
- Verify the installed gifify.sh is non-empty before activating it; make the
optional VERSION download non-fatal.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Makes the install one-liner and the runtime robust enough for anyone to install and run, with dependencies installed and requirements enforced.
Fixes
Critical — spinner crashed under zsh
The frame-cycling substring
${frames:i%${#frames}:1}made zsh throwunrecognized modifier 'i'on every run. zsh is the default shell on modern macOS — exactly whereinstall.shsources the script — so every Mac user saw the error (the GIF still produced, but with a visible error spewed each run). Reworked to use arithmetic expansion, which parses correctly in both bash and zsh.--fpsinput validation--fps abc/--fps 0previously passed straight to ffmpeg and failed mid-encode with a cryptic message. Now validated as a positive integer up front.Installer hardening (
install.sh)ffmpegis actually onPATHafter the install step (a package manager can exit 0 without exposing the binary).ffprobe(used for input analysis; normally bundled with ffmpeg).curlbefore the remote download path, with a clear fallback message.gifify.shis non-empty before activating it; make the optionalVERSIONdownload non-fatal.Verification
shellcheckclean on both scripts.HOMEunder zsh.