Repository navigation
Description
What happens
install_here() ends with:
[ -f "$SKILL_DIR/cc_peer.py" ] || fetch "$RAW/cc_peer.py" "$SKILL_DIR/cc_peer.py"Under curl | sh, $0 is sh, so dirname gives . and src_dir becomes the current working directory — a real path, so the || src_dir="" fallback never fires. With no cc_peer.py in cwd the copy is skipped, and then the line above skips the download too, because a copy is already installed.
Nothing is fetched. The script prints installed cc-peer 0.3.0 on host and exits 0.
Why it matters now
v0.3.0 carried the command-injection fixes from #6. Anyone who followed the README's curl | sh line to pick that up got a success message and an unchanged installation — and no reason to doubt it. This is the only failure mode here that is silent.
Worse variant: if cwd happens to contain an unrelated cc_peer.py, that file gets installed instead.
Also in this file
usage() reads its own source:
sed -n '2,12p' "$0"The header comment is 14 lines, so the output stops mid-sentence — losing "machine needs no internet access", which is the air-gapped selling point. Under curl | sh it fails outright with sed: RE error: illegal byte sequence and prints nothing, so the (try --help) hint in die() is useless on that path too.
Fix
- Trust
src_dironly when$0is a real file; otherwise treat it as unset - Drop the
[ -f ... ] ||guard so a missing local source always fetches and overwrites - Replace the self-reading
usage()with a heredoc — no file self-reference, so it survivescurl | shand stops depending on comment line numbers
While in here, install.sh should also reject a --host starting with - and one carrying ProxyCommand, matching check_ssh_argument() in cc_peer.py. The README claims that protection today, but install.sh has no equivalent — and --uninstall --host sends rm -rf to whatever destination it resolves.
Acceptance criteria
-
curl | shover an existing older install actually upgrades it -
--helpprints the full header on both paths - An unrelated
cc_peer.pyin cwd is not installed -
--hostvalidation matchescc_peer.py - CI gains an
install.shsmoke step —HOME=$(mktemp -d) ./install.sh && "$HOME/.local/bin/cc-peer" --versionwould have caught both bugs; shellcheck did not
Activity
fix: make curl|sh re-run upgrade instead of silently succeeding (#34)