gen and freshen hang forever on a named pipe inside the tree #189

Closed
opened 2026-10-12 11:17:36 +02:00 by clawbot · 1 comment
Collaborator

mfer gen and mfer freshen never finish when the tree they scan holds a named pipe (FIFO). Scanner.enumerateFileWithInfo in mfer/scanner.go and freshenScanner.walk in internal/cli/freshen.go list every entry that is neither a directory nor a symlink, so a pipe is listed as a file of size 0; the hash phase then opens it (Scanner.scanFile, freshenHasher.processEntry) and opening a pipe with no writer blocks until one appears. check hangs the same way when a manifest lists a path that is a pipe on disk (Checker.checkFile in mfer/checker.go). Sockets and device files are listed too; a device such as /dev/zero is read without end.

Reproduce on next (0fbb3da): mkdir t; echo a > t/a.txt; mkfifo t/pipe; mfer gen t never returns; mfer freshen t on that tree likewise.

Correct: gen and freshen list regular files only (with --follow-symlinks, what a symlink points to must be a regular file too) and name what they skipped at verbose level; check reports a listed path that is not a regular file on disk as a failure instead of opening it, and its extra-file search does not report pipes, sockets or devices. fetch already requires a regular file in alreadyPresent.

Definition of done

  • Failing tests first: a pipe in a scanned tree for Scanner, gen and freshen, and a manifest listing a path that is a pipe on disk for check, each finishing with the result above.
  • The fix in mfer/scanner.go, internal/cli/freshen.go and mfer/checker.go.
  • README Tool Examples say gen and freshen list regular files only.
  • make check passes.

Model: fable-5-1

`mfer gen` and `mfer freshen` never finish when the tree they scan holds a named pipe (FIFO). `Scanner.enumerateFileWithInfo` in `mfer/scanner.go` and `freshenScanner.walk` in `internal/cli/freshen.go` list every entry that is neither a directory nor a symlink, so a pipe is listed as a file of size 0; the hash phase then opens it (`Scanner.scanFile`, `freshenHasher.processEntry`) and opening a pipe with no writer blocks until one appears. `check` hangs the same way when a manifest lists a path that is a pipe on disk (`Checker.checkFile` in `mfer/checker.go`). Sockets and device files are listed too; a device such as `/dev/zero` is read without end. Reproduce on `next` (0fbb3da): `mkdir t; echo a > t/a.txt; mkfifo t/pipe; mfer gen t` never returns; `mfer freshen t` on that tree likewise. Correct: `gen` and `freshen` list regular files only (with `--follow-symlinks`, what a symlink points to must be a regular file too) and name what they skipped at verbose level; `check` reports a listed path that is not a regular file on disk as a failure instead of opening it, and its extra-file search does not report pipes, sockets or devices. `fetch` already requires a regular file in `alreadyPresent`. ## Definition of done - Failing tests first: a pipe in a scanned tree for `Scanner`, `gen` and `freshen`, and a manifest listing a path that is a pipe on disk for `check`, each finishing with the result above. - The fix in `mfer/scanner.go`, `internal/cli/freshen.go` and `mfer/checker.go`. - README Tool Examples say `gen` and `freshen` list regular files only. - `make check` passes. Model: fable-5-1
clawbot self-assigned this 2026-10-12 11:17:36 +02:00
Author
Collaborator

#199 makes gen and freshen list regular files only (naming what they skip with -v), and makes check report a listed path that is not a regular file as an error without opening it; its search for extra files leaves out pipes, sockets and devices.

Model: opus-5-5

https://git.eeqj.de/sneak/mfer/pulls/199 makes `gen` and `freshen` list regular files only (naming what they skip with `-v`), and makes `check` report a listed path that is not a regular file as an error without opening it; its search for extra files leaves out pipes, sockets and devices. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/mfer#189