List a directory named through a symlink in gen and freshen (closes #185) #186

Merged
clawbot merged 1 commits from issue-185-symlink-root into next 2026-10-08 05:59:03 +02:00
Collaborator

Fixes #185.

The walks in gen and freshen do not follow a symlink at their top. A directory given as a symlink, or a working directory whose path names one (the shell's PWD, which os.Getwd returns), was listed as empty: gen wrote a manifest with no files and freshen removed every entry. Each walk now resolves its starting directory with filepath.EvalSymlinks first, the way FindExtraFiles in mfer/checker.go does. Symlinks inside the tree still follow --follow-symlinks; the new tests put one there and check it stays out.

What the diff does not show:

  • If resolving fails, the walk starts at the path as named, as in FindExtraFiles. The fallback keeps a scanner on a filesystem other than the disk working (most gen tests use an in-memory one), since EvalSymlinks reads the real disk.
  • freshen resolves inside freshenScan, for the walk only. Hashing still opens files through the base as named, which reaches the same files. freshenManifestOperation is at the linter's function-length limit.
  • Scanner.EnumeratePath carries its own copy of the three lines until #184 makes it call EnumeratePaths. Whichever of the two lands second drops that copy when it rebases.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/mfer/issues/185. The walks in `gen` and `freshen` do not follow a symlink at their top. A directory given as a symlink, or a working directory whose path names one (the shell's `PWD`, which `os.Getwd` returns), was listed as empty: `gen` wrote a manifest with no files and `freshen` removed every entry. Each walk now resolves its starting directory with `filepath.EvalSymlinks` first, the way `FindExtraFiles` in `mfer/checker.go` does. Symlinks inside the tree still follow `--follow-symlinks`; the new tests put one there and check it stays out. What the diff does not show: - If resolving fails, the walk starts at the path as named, as in `FindExtraFiles`. The fallback keeps a scanner on a filesystem other than the disk working (most `gen` tests use an in-memory one), since `EvalSymlinks` reads the real disk. - `freshen` resolves inside `freshenScan`, for the walk only. Hashing still opens files through the base as named, which reaches the same files. `freshenManifestOperation` is at the linter's function-length limit. - `Scanner.EnumeratePath` carries its own copy of the three lines until https://git.eeqj.de/sneak/mfer/pulls/184 makes it call `EnumeratePaths`. Whichever of the two lands second drops that copy when it rebases. Model: opus-5-5
clawbot added the needs-reviewcritical labels 2026-10-08 05:01:58 +02:00
clawbot self-assigned this 2026-10-08 05:01:59 +02:00
clawbot added 1 commit 2026-10-08 05:01:59 +02:00
The walk in gen and freshen does not follow a symlink at its top. A
directory given as a symlink, or a working directory whose path names
one, was listed as empty and gen exited 0, while freshen removed every
entry from the manifest. Each walk now resolves its starting directory
with filepath.EvalSymlinks first, as check's search for extra files
does, and starts at the path as named if that fails. Symlinks inside the
tree are still skipped unless --follow-symlinks is given.

Model: opus-5-5
Author
Collaborator

Review passed.

  • Gated on next at 6229c4e.
  • Judgement call: the second copy of the fix in Scanner.EnumeratePath is acceptable until #184 makes that method call EnumeratePaths.
  • Judgement call: the starting directory is resolved on the real disk even when the scanner is given another filesystem, as the search for extra files in check already does.

Model: opus-5-5

Review passed. - Gated on `next` at `6229c4e`. - Judgement call: the second copy of the fix in `Scanner.EnumeratePath` is acceptable until https://git.eeqj.de/sneak/mfer/pulls/184 makes that method call `EnumeratePaths`. - Judgement call: the starting directory is resolved on the real disk even when the scanner is given another filesystem, as the search for extra files in `check` already does. Model: opus-5-5
clawbot merged commit a5f218e42a into next 2026-10-08 05:59:03 +02:00
clawbot deleted branch issue-185-symlink-root 2026-10-08 05:59:04 +02:00
Sign in to join this conversation.