pipe/archiver: Add more debug messages

This commit is contained in:
Alexander Neumann 2016-02-07 23:22:06 +01:00
parent 9048eb676b
commit 68db75b4e3
2 changed files with 9 additions and 6 deletions

View file

@ -366,6 +366,7 @@ func (arch *Archiver) dirWorker(wg *sync.WaitGroup, p *Progress, done <-chan str
// if we get a nil pointer here, an error has happened while
// processing this entry. Ignore it for now.
if res == nil {
debug.Log("Archiver.dirWorker", "got nil result?")
continue
}
@ -374,7 +375,7 @@ func (arch *Archiver) dirWorker(wg *sync.WaitGroup, p *Progress, done <-chan str
tree.Insert(node)
if node.Type == "dir" {
debug.Log("Archiver.dirWorker", "got tree node for %s: %v", node.path, node.blobs)
debug.Log("Archiver.dirWorker", "got tree node for %s: %v", node.path, node.Subtree)
if node.Subtree.IsNull() {
panic("invalid null subtree ID")

View file

@ -92,7 +92,7 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
info, err := os.Lstat(dir)
if err != nil {
debug.Log("pipe.walk", "error for %v: %v", dir, err)
debug.Log("pipe.walk", "error for %v: %v, res %p", dir, err, res)
select {
case jobs <- Dir{basedir: basedir, path: relpath, info: info, error: err, result: res}:
case <-done:
@ -101,11 +101,12 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
}
if !selectFunc(dir, info) {
debug.Log("pipe.walk", "file %v excluded by filter", dir)
debug.Log("pipe.walk", "file %v excluded by filter, res %p", dir, res)
return
}
if !info.IsDir() {
debug.Log("pipe.walk", "sending file job for %v, res %p", dir, res)
select {
case jobs <- Entry{info: info, basedir: basedir, path: relpath, result: res}:
case <-done:
@ -116,7 +117,7 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
debug.RunHook("pipe.readdirnames", dir)
names, err := readDirNames(dir)
if err != nil {
debug.Log("pipe.walk", "Readdirnames(%v) returned error: %v", dir, err)
debug.Log("pipe.walk", "Readdirnames(%v) returned error: %v, res %p", dir, err, res)
select {
case <-done:
case jobs <- Dir{basedir: basedir, path: relpath, info: info, error: err, result: res}:
@ -143,6 +144,7 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
entries = append(entries, ch)
if statErr != nil {
debug.Log("pipe.walk", "sending file job for %v, err %v, res %p", subpath, err, res)
select {
case jobs <- Entry{info: fi, error: statErr, basedir: basedir, path: filepath.Join(relpath, name), result: ch}:
case <-done:
@ -158,7 +160,7 @@ func walk(basedir, dir string, selectFunc SelectFunc, done <-chan struct{}, jobs
walk(basedir, subpath, selectFunc, done, jobs, ch)
}
debug.Log("pipe.walk", "sending dirjob for %q, basedir %q", dir, basedir)
debug.Log("pipe.walk", "sending dirjob for %q, basedir %q, res %p", dir, basedir, res)
select {
case jobs <- Dir{basedir: basedir, path: relpath, info: info, Entries: entries, result: res}:
case <-done:
@ -217,7 +219,7 @@ func Walk(walkPaths []string, selectFunc SelectFunc, done chan struct{}, jobs ch
debug.Log("pipe.Walk", "walker for %v done", path)
}
debug.Log("pipe.Walk", "sending root node")
debug.Log("pipe.Walk", "sending root node, res %p", res)
select {
case <-done:
return