Skip to content

Harden install and runtime for production use - #7

Merged
pidoshva merged 1 commit into
mainfrom
fix/production-hardening
Jun 27, 2026
Merged

Harden install and runtime for production use#7
pidoshva merged 1 commit into
mainfrom
fix/production-hardening

Conversation

@pidoshva

Copy link
Copy Markdown
Owner

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 throw unrecognized modifier 'i' on every run. zsh is the default shell on modern macOS — exactly where install.sh sources 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.

--fps input validation
--fps abc / --fps 0 previously passed straight to ffmpeg and failed mid-encode with a cryptic message. Now validated as a positive integer up front.

Installer hardening (install.sh)

  • Verify ffmpeg is actually on PATH after the install step (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 message.
  • Verify the installed gifify.sh is non-empty before activating it; make the optional VERSION download non-fatal.

Verification

  • shellcheck clean on both scripts.
  • Sourced and ran a real conversion under both bash and zsh — zsh is now error-free.
  • Full install → run → uninstall cycle in an isolated HOME under zsh.

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>
@pidoshva
pidoshva merged commit 09780d7 into main Jun 27, 2026
1 check passed
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.

1 participant