...
 
Commits (2)
......@@ -39,6 +39,7 @@
# 28/02/2013 V0.7 improve error handling; use error codes
# 26/10/2013 V0.8 dry-run flag introduced
# 09/11/2013 V0.8.1 adjusted help text
# 01/08/2019 V0.8.2 (thof): provide additional debug output
#
# =============================================================================
......@@ -294,6 +295,7 @@ def main(argv=None):
# generate checksumfiles for subdirectories (recursive mode)
# so collect all available subdirectories here (excluding subdirectories)
if not notRecursive:
logger.getLogger().debug("collect subdirectories\n srcpath: %s\n regexes: %s\n followlinks: %s" % (srcpath, regexes, followlinks))
dirs.extend(csfile.getSubDirectories(srcpath, regexes, followlinks))
# if a target directory had been passed extend the list of
# target directories replacing the trunk of the source directory with the
......
......@@ -51,6 +51,10 @@
# files based on time stamp values) for open time windows
# (like all younger than 3 days), we use datetime.max as
# the end time
# 01/08/2019 V0.6.6 (thof) let getSubDirectories produce a reasonable error
# message, if application of a regex fails
# V0.6.7 (thof) capture problem with whitespace in file names
# which results in not accepted hash types
#
# =============================================================================
""" CsFile module to handle checksumfiles. """
......@@ -68,7 +72,7 @@ from datetime import date
import csbacklog
import csbackErrorCodes as eCodes
__version__ = "V0.6.5"
__version__ = "V0.6.7"
__subversion__ = "$Id$"
__license__ = "GPLv2+"
__author__ = "Daniel Armbruster"
......@@ -102,7 +106,10 @@ def getSubDirectories(path, regexes, followLinks=False):
subDirs.add(os.path.join(root, dir))
# exclude directories matching regexes
for regex in regexes:
matching = set(dir for dir in subDirs if None != re.match(regex, dir))
try:
matching = set(dir for dir in subDirs if None != re.match(regex, dir))
except:
raise CsFileError("application of exclude regex %s failed!" % regex, eCodes.CSFILE_CollectingSubDirs)
subDirs -= matching
except OSError as err:
raise CsFileError("[Errno "+str(err.errno)+"] "+err.strerror+": " \
......@@ -490,7 +497,14 @@ class CsLine:
located in src. In case no data file was found in src an CsFileError
exception will be thrown.
"""
hashfunc = hashlib.new(self.hashfunc)
try:
hashfunc = hashlib.new(self.hashfunc)
except:
raise CsFileError(("When evaluating checksum file entry\n in directory %s\n"
+" hash type '%s' as specified for file '%s' is not accepted\n"
+" consider a problem with whitespace in file names\n"
+" the respective checksum file entry is\n"
+" %s") % (self.srcdir, self.hashfunc, self.filename, self), eCodes.GLOBAL_UnhandledException)
blockSize = chunkSize * hashfunc.block_size
path = os.path.join(self.srcdir, self.filename)
try:
......