AI codebase review
fix: duplicate search no longer hangs on files swapped for FIFOs Candidates were reopened by path with os.Open after the scan. A file replaced by a FIFO (or a symlink to one) blocked open(2) forever, and context cancellation could not interrupt it, wedging the duplicate view and --duplicates. Content is now opened with O_NOFOLLOW|O_NONBLOCK on Unix; the existing regular-file check then skips it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1f9429ea74
commit
5966fdd91e
@@ -18,6 +18,7 @@ import (
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/andydixon/mapsize/internal/inventory"
|
||||
"github.com/andydixon/mapsize/internal/platform"
|
||||
)
|
||||
|
||||
// Group is a set of files verified to have identical content.
|
||||
@@ -226,7 +227,7 @@ func (f *Finder) splitHash(ctx context.Context, g []cand, workers int) []fullGro
|
||||
|
||||
// open opens a candidate and checks it still has the inventoried size.
|
||||
func open(c cand) (*os.File, bool) {
|
||||
fh, err := os.Open(c.path)
|
||||
fh, err := platform.OpenContent(c.path)
|
||||
if err != nil {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user