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:
+16
-7
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user