Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
csback
Commits
2f899dfb
Commit
2f899dfb
authored
Aug 01, 2019
by
thomas.forbriger
Committed by
Checksum Backup @bromo
Aug 01, 2019
Browse files
csfile.py: capture error in case of illegal hash type
parent
8e0b087e
Changes
1
Hide whitespace changes
Inline
Side-by-side
csfile.py
View file @
2f899dfb
...
@@ -53,6 +53,8 @@
...
@@ -53,6 +53,8 @@
# the end time
# the end time
# 01/08/2019 V0.6.6 (thof) let getSubDirectories produce a reasonable error
# 01/08/2019 V0.6.6 (thof) let getSubDirectories produce a reasonable error
# message, if application of a regex fails
# 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. """
""" CsFile module to handle checksumfiles. """
...
@@ -70,7 +72,7 @@ from datetime import date
...
@@ -70,7 +72,7 @@ from datetime import date
import
csbacklog
import
csbacklog
import
csbackErrorCodes
as
eCodes
import
csbackErrorCodes
as
eCodes
__version__
=
"V0.6.
6
"
__version__
=
"V0.6.
7
"
__subversion__
=
"$Id$"
__subversion__
=
"$Id$"
__license__
=
"GPLv2+"
__license__
=
"GPLv2+"
__author__
=
"Daniel Armbruster"
__author__
=
"Daniel Armbruster"
...
@@ -495,7 +497,14 @@ class CsLine:
...
@@ -495,7 +497,14 @@ class CsLine:
located in src. In case no data file was found in src an CsFileError
located in src. In case no data file was found in src an CsFileError
exception will be thrown.
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
blockSize
=
chunkSize
*
hashfunc
.
block_size
path
=
os
.
path
.
join
(
self
.
srcdir
,
self
.
filename
)
path
=
os
.
path
.
join
(
self
.
srcdir
,
self
.
filename
)
try
:
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment