mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-14 01:04:14 +00:00
lib/scanner: Pass on errors while hashing (#7380)
This commit is contained in:
parent
e159f76ced
commit
b0cce98648
@ -104,7 +104,7 @@ func (ph *parallelHasher) hashFiles(ctx context.Context) {
|
|||||||
|
|
||||||
blocks, err := HashFile(ctx, ph.fs, f.Name, f.BlockSize(), ph.counter, true)
|
blocks, err := HashFile(ctx, ph.fs, f.Name, f.BlockSize(), ph.counter, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Debugln("hash error:", f.Name, err)
|
handleError(ctx, "hashing", f.Name, err, ph.outbox)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protoco
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !utf8.ValidString(path) {
|
if !utf8.ValidString(path) {
|
||||||
w.handleError(ctx, "scan", path, errUTF8Invalid, finishedChan)
|
handleError(ctx, "scan", path, errUTF8Invalid, finishedChan)
|
||||||
return skip
|
return skip
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protoco
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.handleError(ctx, "scan", path, err, finishedChan)
|
handleError(ctx, "scan", path, err, finishedChan)
|
||||||
return skip
|
return skip
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protoco
|
|||||||
info, err = w.Filesystem.Lstat(ignoredParent)
|
info, err = w.Filesystem.Lstat(ignoredParent)
|
||||||
// An error here would be weird as we've already gotten to this point, but act on it nonetheless
|
// An error here would be weird as we've already gotten to this point, but act on it nonetheless
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.handleError(ctx, "scan", ignoredParent, err, finishedChan)
|
handleError(ctx, "scan", ignoredParent, err, finishedChan)
|
||||||
return skip
|
return skip
|
||||||
}
|
}
|
||||||
if err = w.handleItem(ctx, ignoredParent, info, toHashChan, finishedChan, skip); err != nil {
|
if err = w.handleItem(ctx, ignoredParent, info, toHashChan, finishedChan, skip); err != nil {
|
||||||
@ -333,7 +333,7 @@ func (w *walker) handleItem(ctx context.Context, path string, info fs.FileInfo,
|
|||||||
oldPath := path
|
oldPath := path
|
||||||
path, err := w.normalizePath(path, info)
|
path, err := w.normalizePath(path, info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.handleError(ctx, "normalizing path", oldPath, err, finishedChan)
|
handleError(ctx, "normalizing path", oldPath, err, finishedChan)
|
||||||
return skip
|
return skip
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ func (w *walker) walkSymlink(ctx context.Context, relPath string, info fs.FileIn
|
|||||||
|
|
||||||
f, err := CreateFileInfo(info, relPath, w.Filesystem)
|
f, err := CreateFileInfo(info, relPath, w.Filesystem)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.handleError(ctx, "reading link:", relPath, err, finishedChan)
|
handleError(ctx, "reading link:", relPath, err, finishedChan)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,7 +556,7 @@ func (w *walker) updateFileInfo(file, curFile protocol.FileInfo) protocol.FileIn
|
|||||||
return file
|
return file
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *walker) handleError(ctx context.Context, context, path string, err error, finishedChan chan<- ScanResult) {
|
func handleError(ctx context.Context, context, path string, err error, finishedChan chan<- ScanResult) {
|
||||||
// Ignore missing items, as deletions are not handled by the scanner.
|
// Ignore missing items, as deletions are not handled by the scanner.
|
||||||
if fs.IsNotExist(err) {
|
if fs.IsNotExist(err) {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user