lib/fs: Fix watcher panic due to casing on windows (fixes #4877) (#4878)

This commit is contained in:
Simon Frei
2018-04-16 20:07:00 +02:00
committed by Jakob Borg
parent 8f6d587ecb
commit 01aef75c96
3 changed files with 48 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ package fs
import (
"context"
"errors"
"fmt"
"path/filepath"
"strings"
@@ -23,7 +24,7 @@ import (
var backendBuffer = 500
func (f *BasicFilesystem) Watch(name string, ignore Matcher, ctx context.Context, ignorePerms bool) (<-chan Event, error) {
absName, err := f.rooted(name)
absName, err := f.rootedSymlinkEvaluated(name)
if err != nil {
return nil, err
}
@@ -110,7 +111,7 @@ func (f *BasicFilesystem) unrootedChecked(absPath string) string {
return "."
}
if !strings.HasPrefix(absPath, f.rootSymlinkEvaluated) {
panic("bug: Notify backend is processing a change outside of the watched path: " + absPath)
panic(fmt.Sprintf("bug: Notify backend is processing a change outside of the filesystem root: root==%v, rootSymEval==%v, path==%v", f.root, f.rootSymlinkEvaluated, absPath))
}
return f.unrootedSymlinkEvaluated(absPath)
}