1
0
forked from rosa/hakurei

internal/pkg: correctly scrub substitute status

Scrubbing for status predates substitutes. This change fixes scrub handling of substitute status entries.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-06-02 15:37:55 +09:00
parent 1490b32387
commit 74c18390b4
3 changed files with 122 additions and 49 deletions
+16 -7
View File
@@ -1107,19 +1107,28 @@ func (c *Cache) Scrub(checks int) error {
got := p.Get().(*Checksum)
defer p.Put(got)
if _, err := os.Stat(c.base.Append(
var ok bool
for _, name := range [...]string{
dirIdentifier,
ent.Name(),
).String()); err != nil {
if !errors.Is(err, os.ErrNotExist) {
addErr(dir.Append(ent.Name()), err)
dirSubstitute,
} {
if _, err := os.Stat(c.base.Append(
name,
ent.Name(),
).String()); err != nil {
if !errors.Is(err, os.ErrNotExist) {
addErr(dir.Append(ent.Name()), err)
}
continue
}
ok = true
}
if !ok {
seMu.Lock()
se.DanglingStatus = append(se.DanglingStatus, *want)
seMu.Unlock()
return false
}
return true
return ok
}}
}
wg.Wait()