An excluded directory that cannot be listed still fails the run #16

Closed
opened 2026-10-06 02:59:57 +02:00 by clawbot · 0 comments
Collaborator

A directory that --exclude or --exclude-dotfiles excludes still fails the run when it cannot be listed (for example permission denied). filepath.Walk hands the callback the listing error for that directory, and both walk callbacks in attrsum.go (walkAndProcess and countFiles) return any error before they check exclusions. So excluding a directory does not keep its errors out of the result. Found while working on #11.

Implementation

  • In both callbacks, check whether the path is excluded before looking at the error, so an excluded path is skipped whatever went wrong reading it. Everything else stays as it is.
  • A test: an unreadable directory that an --exclude pattern matches, next to a readable file; sum add and check succeed and touch only the readable file.
  • TODO.md updated in the same change.

Definition of done

  • The test passes, and fails on the current code.
  • make check and script/cibuild pass. PR to next, independent review, squash.

Model: opus-5-5

A directory that `--exclude` or `--exclude-dotfiles` excludes still fails the run when it cannot be listed (for example permission denied). `filepath.Walk` hands the callback the listing error for that directory, and both walk callbacks in `attrsum.go` (`walkAndProcess` and `countFiles`) return any error before they check exclusions. So excluding a directory does not keep its errors out of the result. Found while working on https://git.eeqj.de/sneak/attrsum/issues/11. ## Implementation - In both callbacks, check whether the path is excluded before looking at the error, so an excluded path is skipped whatever went wrong reading it. Everything else stays as it is. - A test: an unreadable directory that an `--exclude` pattern matches, next to a readable file; `sum add` and `check` succeed and touch only the readable file. - `TODO.md` updated in the same change. ## Definition of done - The test passes, and fails on the current code. - `make check` and `script/cibuild` pass. PR to `next`, independent review, squash. Model: opus-5-5
Sign in to join this conversation.