Skip to content

feat(install): a script that verifies what it downloads (#138) - #421

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/138b-install-script
Aug 9, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/138b-install-script

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Part (b) of #138. Part (a) merged in #420; part (c) still needs a hosting decision.

Not the script #138 specifies, and why

#138's install.sh detects the package manager and adds a repository at packages.objectfs.io. That host does not exist — both objectfs.io and packages.objectfs.io resolve to registrar parking IPs and neither completes a TLS handshake. A script written to that spec could not be run, could not be tested, and would fail at its first curl with a TLS error naming a domain the reader has no way to interpret.

What GitHub already hosts is a tarball per platform with a SHA-256 beside it. That needs no hosting decision, so it is what this installs.

The checksum is verified and there is no flag to skip it

The reason to publish a checksum is that the download path is not trusted, and an installer that treats verification as skippable has spent the cost without buying the property. What it establishes is stated on the page rather than implied: the .sha256 travels the same channel as the tarball, so this detects corruption and a mangling mirror — not a compromise of the release host. That is a signature's job, and this project does not sign releases.

The default prefix is ~/.local, not /usr/local, reversing the usual convention on purpose. This project's users are frequently on a shared login node with no root, and an installer whose default needs sudo teaches them to run the whole thing under sudo — which writes a root-owned binary and root-owned cache directories into a home their own jobs use.

shellcheck passed and it was still broken on two of three images

shellcheck was clean from the first draft. The local macOS run installed successfully against the real v0.13.0 release. And the script failed on two of the three images #138 names — both times with an error naming the wrong cause:

image what it lacks what the script said
ubuntu:24.04 neither curl nor wget "could not reach the GitHub API to find the latest release. Pass --version to skip this step"
opensuse/leap:15.6 neither tar nor gzip "a tar that cannot read the archive rather than a corrupt file" — after a successful download and a verified checksum

Installing only tar on openSUSE moved the same misattribution one layer down: tar -xzf shells out to gzip and reports the child's status as its own, giving tar: Child returned status 2.

A wrong cause is the expensive failure direction — it sends the reader to check the release, the network and the file, and never mentions the missing package. Both are now one preflight that runs before anything touches the network, reports every missing tool at once (openSUSE would otherwise need three attempts to learn what it needs), and names the package to install. It runs ahead of --dry-run too, since a dry run's job is to report whether this would work.

The CI job

install-script, matrix over #138's three images. It asserts refusal and success per row — a job that checked only the refusal would pass against a script that can no longer install anything — plus that the checksum line appears, that the installed binary prints a version, and that two runs leave the identical binary.

rockylinux:9 installs nothing beforehand, which makes it the row that would catch a preflight demanding something the script does not need.

It does not use LocalStack, which #138 specifies: nothing here touches S3. The script downloads a GitHub release asset and runs objectfs --version, so a mock S3 endpoint would be machinery with nothing behind it. It also tests the last release's binary rather than the PR's, which is the right subject — the thing under test is the install path, and pointing it at an artifact built in this workflow would test a URL no user will ever fetch.

The gate covers what CI cannot

That job runs on x86_64, so it exercises exactly one row of the platform mapping: a mapping wrong for arm64, armv7 or darwin passes all three images. So TestInstallScriptNamesEveryPublishedAsset couples the script's uname translation to release.yml's build matrix in both directions.

One mutation is recorded as unverified locally rather than claimed as caught: reversing the x86_64 mapping was expected to fail the container run and did not, because podman on an Apple Silicon host runs an arm64 binary inside an emulated amd64 container through binfmt — so the wrong-architecture binary executed and printed its version. On a real x86_64 runner the script's final --version check catches it; the static assertion is what makes that independent of the host.

Ten mutations, and one initially survived:

G1 arch mapping wrong (the one containers missed) CAUGHT
G2 arm64 row dropped CAUGHT
G3 darwin dropped CAUGHT
G4 checksum comparison skipped CAUGHT
G5 missing .sha256 softened to a warning CAUGHT
G6 --skip-checksum escape hatch added CAUGHT
G7 preflight call removed CAUGHT
G8 preflight moved below the API call initially MISSED → CAUGHT
G8b preflight moved below the download CAUGHT
G9 new release platform the script cannot name CAUGHT

G8 is the instructive one: moving preflight to sit immediately above the download still passed, because it was still before the download — but by then the script has already queried the GitHub API, which on a machine with no downloader is precisely the failure preflight exists to pre-empt. The check is now anchored to the API call rather than the download, and both orderings are asserted.

Verification

  • The installer run against the real v0.13.0 release: macOS arm64, and all three container images
  • ubuntu:24.04 with only wget installed — exercises the wget branch of release resolution, which is the path that produced the original wrong error
  • Failure paths: nonexistent version (exit 1, no misleading checksum error, nothing installed), unwritable prefix, bad flag, flag missing its value — all exit 1, no leftover temp dirs
  • Idempotent: two runs, identical binary hash
  • The CI job's own shell logic run locally against all three rows with podman standing in for docker — 15/15 assertions
  • shellcheck clean; gofmt, go vet, golangci-lint 0 issues; ci.yml parses, 15 jobs

Docs

Three pages claimed no packages are built, which part (a) made false — docs-platform/guide/getting-started.md, docs/index.md, and the README's install section. The README also said make build produces ./objectfs when it produces ./bin/objectfs.

Still open on #138

Part (c) — the apt/yum repository setup scripts and the curl | bash one-liner against a project domain — needs a hosting decision, not code: stand up packages.objectfs.io, use Cloudsmith/Fury/a Pages apt-yum repo/COPR/OBS, or skip repositories entirely. Measurements and the recommended split are on #138. #138 stays open.

Part (b) of #138, and deliberately not the script that issue specifies. That
one detects the package manager and adds a repository at
packages.objectfs.io -- a host that does not exist. Both objectfs.io and
packages.objectfs.io resolve to registrar parking IPs and neither completes a
TLS handshake, so a script written to that spec could not be run, could not
be tested, and would fail at its first curl with a TLS error naming a domain
the reader cannot interpret. What GitHub already hosts is a tarball per
platform with a checksum beside it, which needs no hosting decision.

The checksum is verified and there is no flag to skip it. The reason to
publish a checksum is that the download path is not trusted, and an
installer treating verification as skippable has spent the cost without
buying the property. What it establishes is stated rather than implied: the
.sha256 travels the same channel as the tarball, so this detects corruption
and a mangling mirror, not a compromise of the release host.

The default prefix is ~/.local rather than /usr/local, reversing the usual
convention on purpose. This project's users are frequently on a shared login
node with no root, and an installer whose default needs sudo teaches them to
run the whole thing under sudo -- which writes a root-owned binary and
root-owned cache directories into a home their own jobs use.

shellcheck passed from the first draft and the local run succeeded, and the
script still failed on two of the three images #138 names, both times with
an error naming the wrong cause:

  - ubuntu:24.04 ships neither curl nor wget. The download helper handled
    that, but release resolution called wget unconditionally when curl was
    absent, so the user was told "could not reach the GitHub API to find the
    latest release. Pass --version to skip this step" -- advice that cannot
    work on a machine with no downloader.
  - opensuse/leap:15.6 ships neither tar nor gzip. The script downloaded the
    archive, verified its checksum, then reported "a tar that cannot read
    the archive rather than a corrupt file" -- a confident claim about the
    file when tar was not installed. Installing only tar moved the same
    misattribution one layer down: tar -xzf shells out to gzip and reports
    the child's status as its own.

A wrong cause is the expensive direction: it sends the reader to check the
release, the network and the file, and never mentions the missing package.
Both are now one preflight check that runs before anything touches the
network, reports every missing tool at once -- openSUSE would otherwise need
three attempts -- and names the package to install. It runs ahead of
--dry-run too, since a dry run's job is to report whether this would work.

The CI job asserts refusal AND success per image; a job checking only the
refusal would pass against a script that can no longer install anything. It
does not use LocalStack, which #138 specifies: nothing here touches S3.

internal/config/install_script_test.go covers what that job cannot. It runs
on x86_64, so it exercises one row of the platform mapping -- a mapping
wrong for arm64, armv7 or darwin passes all three images. So the script's
uname translation is coupled to release.yml's build matrix in both
directions. One mutation is recorded as unverified locally rather than
claimed as caught: reversing the x86_64 mapping was expected to fail the
container run and did not, because podman on an Apple Silicon host runs an
arm64 binary inside an emulated amd64 container through binfmt, so the
wrong-architecture binary executed and printed its version.

Ten mutations run, one initially survived: moving preflight to sit
immediately above the download still passed, because it was still before the
download -- but by then the API has been queried, which on a machine with no
downloader is the failure preflight exists to pre-empt. The check is now
anchored to the API call, and both orderings are asserted.

Three docs claimed no packages are built, which part (a) made false, and
README.md said `make build` produces ./objectfs rather than ./bin/objectfs.
@scttfrdmn
scttfrdmn merged commit 41021af into main Aug 9, 2026
42 checks passed
@scttfrdmn
scttfrdmn deleted the feat/138b-install-script branch August 9, 2026 21:37
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