Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Commit

Permalink
some bug with counting files in caches
Browse files Browse the repository at this point in the history
  • Loading branch information
DeaDSouL committed Sep 25, 2019
1 parent d6a6c7e commit caba8a2
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions dugu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python2
#/usr/bin/env python2
# -*- coding: UTF-8 -*-
# By: DeaDSouL (Mubarak Alrashidi)
Expand Down Expand Up @@ -360,7 +360,14 @@ def __loadCache(self):
dups_sum = 0
for sig,files in self.dups_result['dups'].iteritems():
dups_sum += len(files)-1
if not self.__validatedCache() or self.dups_result['dups_count'] != dups_sum or self.dups_result['dups_sets'] != len(self.dups_result['dups']):
#if not self.__validatedCache() or self.dups_result['dups_count'] != dups_sum or self.dups_result['dups_sets'] != len(self.dups_result['dups']):
if not self.__validatedCache():
print 'Changes Detected.......Done \r'
self.__preScanDir()
elif self.dups_result['dups_count'] != dups_sum:
print 'Changes Detected.......Done \r'
self.__preScanDir()
elif self.dups_result['dups_sets'] != len(self.dups_result['dups']):
print 'Changes Detected.......Done \r'
self.__preScanDir()
else:
Expand All @@ -376,8 +383,14 @@ def __loadCache(self):
# ------------------------------------------------------------------

def __validatedCache(self):
if self.scan_result['total_files'] != len(self.scan_result['files']):
return False
# Sometimes scan_result['files'] is less than scan_result['total_files'] by 1
# appearantly it's a bug, we need to inspect the code responsible of calculating
# the total_files, when we save it in the cache!!
# for the time being, we just comment the following 2 lines
# ----------
#if self.scan_result['total_files'] != len(self.scan_result['files']):
# return False
# ----------
i = 0
# arr[0]=size, arr[1]=mtime, arr[2]=hash
for file,arr in self.scan_result['files'].iteritems():
Expand Down

0 comments on commit caba8a2

Please sign in to comment.