Merge pull request #1776 from restic/fix-1775

Always use cleaned path for excludes
This commit is contained in:
Alexander Neumann 2018-05-13 00:13:52 +02:00
commit 903a3a31dc
2 changed files with 8 additions and 32 deletions

View File

@ -185,6 +185,11 @@ func isDirExcludedByFile(dir, tagFilename, header string) bool {
func gatherDevices(items []string) (deviceMap map[string]uint64, err error) {
deviceMap = make(map[string]uint64)
for _, item := range items {
item, err = filepath.Abs(filepath.Clean(item))
if err != nil {
return nil, err
}
fi, err := fs.Lstat(item)
if err != nil {
return nil, err
@ -215,6 +220,8 @@ func rejectByDevice(samples []string) (RejectFunc, error) {
return false
}
item = filepath.Clean(item)
id, err := fs.DeviceID(fi)
if err != nil {
// This should never happen because gatherDevices() would have
@ -222,7 +229,7 @@ func rejectByDevice(samples []string) (RejectFunc, error) {
panic(err)
}
for dir := item; dir != ""; dir = filepath.Dir(dir) {
for dir := item; dir != filepath.Dir(dir); dir = filepath.Dir(dir) {
debug.Log("item %v, test dir %v", item, dir)
allowedID, ok := allowed[dir]

View File

@ -1,31 +0,0 @@
/boot
/dev
/etc
/home
/lost+found
/mnt
/proc
/root
/run
/sys
/tmp
/usr
/var
/opt/android-sdk
/opt/bullet
/opt/dex2jar
/opt/jameica
/opt/google
/opt/JDownloader
/opt/JDownloaderScripts
/opt/opencascade
/opt/vagrant
/opt/visual-studio-code
/opt/vtk6
/bin
/fonts*
/srv/ftp
/srv/http
/sbin
/lib
/lib64