mfer check given a URL fails in the Docker image: the scratch image has no /tmp and check writes the downloaded manifest to a temp file #223

Closed
opened 2026-10-14 02:22:00 +02:00 by clawbot · 2 comments
Collaborator

mfer check given a URL writes the manifest to a temp file before loading it: fetchManifestToTemp in internal/cli/check.go calls afero.TempFile(mfa.Fs, "", "mfer-manifest-*.mf"), which creates the file under os.TempDir(). The image script/cibuild builds is FROM scratch with only /mfer and the CA certificates, so it has no /tmp, and mfer check <URL> fails there with open /tmp/mfer-manifest-NNN.mf: no such file or directory, exit 1. list, export and fetch given a URL work in the image: they keep the downloaded manifest in memory (openManifestReader in internal/cli/manifest_loader.go; fetchManifest in internal/cli/fetch.go, whose verifyFetchedSigner hands the downloaded bytes to NewChecker through an in-memory filesystem). The same failure hits any host whose TMPDIR cannot be written.

Reproduce on v1.0.0-rc1: build the image with script/cibuild, serve a directory holding an index.mf over HTTP, then docker run --rm --network host mfer check http://127.0.0.1:8000/index.mf. On a host: TMPDIR=/nonexistent mfer check --base DIR http://127.0.0.1:8000/index.mf fails the same way while the same command without TMPDIR passes.

Correct: check given a URL loads the manifest it downloaded without a temp file, as fetch does, and verifies the tree under --base (or the current directory) against it; nothing check does depends on a temp directory. Giving the image a /tmp alone is not enough: the host failure stays.

Severity: major

Definition of done

  • Failing test first: through the CLI entry point on the real filesystem, check --base DIR <URL> of an intact tree served by httptest passes with TMPDIR set to a directory that does not exist.
  • The fix in internal/cli/check.go, and in mfer/checker.go only if the Checker must be handed the manifest another way.
  • make check passes, and the image script/cibuild builds runs mfer check <URL>.

Model: fable-5-1

`mfer check` given a URL writes the manifest to a temp file before loading it: `fetchManifestToTemp` in `internal/cli/check.go` calls `afero.TempFile(mfa.Fs, "", "mfer-manifest-*.mf")`, which creates the file under `os.TempDir()`. The image `script/cibuild` builds is `FROM scratch` with only `/mfer` and the CA certificates, so it has no `/tmp`, and `mfer check <URL>` fails there with `open /tmp/mfer-manifest-NNN.mf: no such file or directory`, exit 1. `list`, `export` and `fetch` given a URL work in the image: they keep the downloaded manifest in memory (`openManifestReader` in `internal/cli/manifest_loader.go`; `fetchManifest` in `internal/cli/fetch.go`, whose `verifyFetchedSigner` hands the downloaded bytes to `NewChecker` through an in-memory filesystem). The same failure hits any host whose `TMPDIR` cannot be written. Reproduce on `v1.0.0-rc1`: build the image with `script/cibuild`, serve a directory holding an `index.mf` over HTTP, then `docker run --rm --network host mfer check http://127.0.0.1:8000/index.mf`. On a host: `TMPDIR=/nonexistent mfer check --base DIR http://127.0.0.1:8000/index.mf` fails the same way while the same command without `TMPDIR` passes. Correct: `check` given a URL loads the manifest it downloaded without a temp file, as `fetch` does, and verifies the tree under `--base` (or the current directory) against it; nothing `check` does depends on a temp directory. Giving the image a `/tmp` alone is not enough: the host failure stays. Severity: major ## Definition of done - Failing test first: through the CLI entry point on the real filesystem, `check --base DIR <URL>` of an intact tree served by `httptest` passes with `TMPDIR` set to a directory that does not exist. - The fix in `internal/cli/check.go`, and in `mfer/checker.go` only if the Checker must be handed the manifest another way. - `make check` passes, and the image `script/cibuild` builds runs `mfer check <URL>`. Model: fable-5-1
clawbot self-assigned this 2026-10-14 02:22:00 +02:00
Author
Collaborator

Plan: built as the issue says. check given a URL loads the manifest it downloaded from memory, as fetch does, and writes no temp file. One PR to next through an independent review. Worker rules: #99 (comment), without the TODO.md step.

Model: opus-5-5

Plan: built as the issue says. `check` given a URL loads the manifest it downloaded from memory, as `fetch` does, and writes no temp file. One PR to `next` through an independent review. Worker rules: https://git.eeqj.de/sneak/mfer/issues/99#issuecomment-115880, without the `TODO.md` step. Model: opus-5-5
Author
Collaborator

Built in #227: check given a URL keeps the downloaded manifest in memory and hands it to the Checker through a new Manifest reader in CheckerOptions, since the Checker otherwise reads its manifest from the filesystem holding the files it checks.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/mfer/pulls/227: `check` given a URL keeps the downloaded manifest in memory and hands it to the Checker through a new `Manifest` reader in `CheckerOptions`, since the Checker otherwise reads its manifest from the filesystem holding the files it checks. Model: opus-5-5
Sign in to join this conversation.