gen and freshen list an index.mf at the top of the tree when writing the manifest elsewhere, and fetch then refuses the manifest #233

Closed
opened 2026-10-15 23:25:49 +02:00 by clawbot · 3 comments
Collaborator

gen and freshen leave out of the manifest only the file they write. Given -o (for gen) or a manifest outside the directory they list (for freshen --base DIR), they list a file named index.mf at the top of that directory like any other file. fetch refuses a manifest that lists index.mf at the top of the tree, since it saves the manifest there (README, mfer fetch), so gen writes a manifest mfer's own fetch will not take. check already never reports index.mf at the top of the base directory as unlisted (#229), for the same reason.

Reproduce on next: a directory srv holding a.txt and a stray index.mf; mfer gen -o out/other.mf srv lists both; serve srv with out/other.mf copied into it as published.mf; mfer fetch --dest mirror http://HOST/published.mf stops with manifest lists a file where fetch writes another file: index.mf (the saved manifest).

Correct: gen and freshen never list index.mf at the top of the directory they list, wherever they write the manifest, so every manifest they write is one fetch accepts. index.mf in a subdirectory is still listed.

Severity: minor

Definition of done

  • Failing tests first, through the CLI entry point: gen -o OTHER DIR with an index.mf at the top of DIR does not list it; freshen --base DIR OTHER likewise; both still list index.mf in a subdirectory.
  • The fix in package cli (internal/cli/gen.go, internal/cli/freshen.go), which owns the default manifest name; package mfer changes only if its scanner cannot be told which file to leave out another way.
  • README, mfer gen and mfer freshen sections: say index.mf at the top of the directory is never listed.
  • make check passes.

Model: opus-5-5

`gen` and `freshen` leave out of the manifest only the file they write. Given `-o` (for `gen`) or a manifest outside the directory they list (for `freshen --base DIR`), they list a file named `index.mf` at the top of that directory like any other file. `fetch` refuses a manifest that lists `index.mf` at the top of the tree, since it saves the manifest there (README, `mfer fetch`), so `gen` writes a manifest mfer's own `fetch` will not take. `check` already never reports `index.mf` at the top of the base directory as unlisted (https://git.eeqj.de/sneak/mfer/issues/229), for the same reason. Reproduce on `next`: a directory `srv` holding `a.txt` and a stray `index.mf`; `mfer gen -o out/other.mf srv` lists both; serve `srv` with `out/other.mf` copied into it as `published.mf`; `mfer fetch --dest mirror http://HOST/published.mf` stops with `manifest lists a file where fetch writes another file: index.mf (the saved manifest)`. Correct: `gen` and `freshen` never list `index.mf` at the top of the directory they list, wherever they write the manifest, so every manifest they write is one `fetch` accepts. `index.mf` in a subdirectory is still listed. Severity: minor ## Definition of done - Failing tests first, through the CLI entry point: `gen -o OTHER DIR` with an `index.mf` at the top of `DIR` does not list it; `freshen --base DIR OTHER` likewise; both still list `index.mf` in a subdirectory. - The fix in package `cli` (`internal/cli/gen.go`, `internal/cli/freshen.go`), which owns the default manifest name; package `mfer` changes only if its scanner cannot be told which file to leave out another way. - README, `mfer gen` and `mfer freshen` sections: say `index.mf` at the top of the directory is never listed. - `make check` passes. Model: opus-5-5
clawbot self-assigned this 2026-10-15 23:25:49 +02:00
Author
Collaborator

Plan: built as the issue says, one PR to next through an independent review, alongside the rework of #232; whichever lands second rebases, since both add a README.md bullet and CLI tests. Worker rules: #99 (comment), without the TODO.md step.

Model: opus-5-5

Plan: built as the issue says, one PR to `next` through an independent review, alongside the rework of https://git.eeqj.de/sneak/mfer/pulls/232; whichever lands second rebases, since both add a `README.md` bullet and CLI tests. 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 #234: gen and freshen leave out each file whose path in the manifest would be exactly index.mf, which is index.mf at the top of a directory gen is given or of the base directory freshen lists, and a file gen is given by that name. No file is looked up for this, so a symlink named index.mf never leaves out the file it points to. index.mf in a subdirectory is still listed. Not covered, though fetch refuses those too: INDEX.MF in another letter case, and .index.mf.tmp listed with --include-dotfiles.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/mfer/pulls/234: `gen` and `freshen` leave out each file whose path in the manifest would be exactly `index.mf`, which is `index.mf` at the top of a directory `gen` is given or of the base directory `freshen` lists, and a file `gen` is given by that name. No file is looked up for this, so a symlink named `index.mf` never leaves out the file it points to. `index.mf` in a subdirectory is still listed. Not covered, though `fetch` refuses those too: `INDEX.MF` in another letter case, and `.index.mf.tmp` listed with `--include-dotfiles`. Model: opus-5-5
Author
Collaborator

Scope, decided: only the exact name index.mf at the top of the tree is left out, since that is where gen writes the manifest and a stray one is a stale manifest. A file at the top named index.mf in another letter case, or .index.mf.tmp listed under --include-dotfiles, is the user's own file and stays listed; fetch refusing such a tree, because it cannot write it safely, is correct and not part of this issue.

Model: opus-5-5

Scope, decided: only the exact name `index.mf` at the top of the tree is left out, since that is where `gen` writes the manifest and a stray one is a stale manifest. A file at the top named `index.mf` in another letter case, or `.index.mf.tmp` listed under `--include-dotfiles`, is the user's own file and stays listed; `fetch` refusing such a tree, because it cannot write it safely, is correct and not part of this issue. Model: opus-5-5
Sign in to join this conversation.