From a868a30f4deba4d407dcfb150aa8fb333074f529 Mon Sep 17 00:00:00 2001 From: Mikael Berthe Date: Wed, 16 May 2018 13:44:14 +0200 Subject: [PATCH] Fix restic backup --one-file-system / This patch should fix the following panic when trying to backup the root filesystem with thre --one-file-system flag: % restic backup --one-file-system / (...) panic: item /, device id 2082 not found, allowedDevs: map[/:2082] --- cmd/restic/exclude.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/restic/exclude.go b/cmd/restic/exclude.go index 9d86f9892..537bdc344 100644 --- a/cmd/restic/exclude.go +++ b/cmd/restic/exclude.go @@ -229,11 +229,14 @@ func rejectByDevice(samples []string) (RejectFunc, error) { panic(err) } - for dir := item; dir != filepath.Dir(dir); dir = filepath.Dir(dir) { + for dir := item; ; dir = filepath.Dir(dir) { debug.Log("item %v, test dir %v", item, dir) allowedID, ok := allowed[dir] if !ok { + if dir == filepath.Dir(dir) { + break + } continue }