Skip to content

Commit

Permalink
Use quotes around files in FileLists for debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
fviard committed Oct 3, 2022
1 parent 5cd5b23 commit d43f30d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions S3/FileLists.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def handle_exclude_include_walk_dir(root, dirname):
directory_patterns = (u'/)$', u'/)\\Z', u'\\/$', u'\\/\\Z(?ms)')

d = os.path.join(root, dirname, '')
debug(u"CHECK: %s" % d)
debug(u"CHECK: '%s'" % d)
excluded = False
for r in cfg.exclude:
if not any(r.pattern.endswith(dp) for dp in directory_patterns):
Expand All @@ -83,16 +83,16 @@ def handle_exclude_include_walk_dir(root, dirname):
if not any(r.pattern.endswith(dp) for dp in directory_patterns):
# we only check for directory patterns here
continue
debug(u"INCL-TEST: %s ~ %s" % (d, r.pattern))
debug(u"INCL-TEST: '%s' ~ %s" % (d, r.pattern))
if r.search(d):
excluded = False
debug(u"INCL-MATCH: '%s'" % (cfg.debug_include[r]))
break
if excluded:
## Still excluded - ok, action it
debug(u"EXCLUDE: %s" % d)
debug(u"EXCLUDE: '%s'" % d)
else:
debug(u"PASS: %s" % d)
debug(u"PASS: '%s'" % d)
return excluded

def _fswalk_follow_symlinks(path):
Expand Down Expand Up @@ -133,7 +133,7 @@ def filter_exclude_include(src_list):
cfg = Config()
exclude_list = FileDict(ignore_case = False)
for file in src_list.keys():
debug(u"CHECK: %s" % file)
debug(u"CHECK: '%s'" % file)
excluded = False
for r in cfg.exclude:
if r.search(file):
Expand All @@ -149,12 +149,12 @@ def filter_exclude_include(src_list):
break
if excluded:
## Still excluded - ok, action it
debug(u"EXCLUDE: %s" % file)
debug(u"EXCLUDE: '%s'" % file)
exclude_list[file] = src_list[file]
del(src_list[file])
continue
else:
debug(u"PASS: %s" % file)
debug(u"PASS: '%s'" % file)
return src_list, exclude_list


Expand Down Expand Up @@ -574,27 +574,27 @@ def _compare(src_list, dst_lst, src_remote, dst_remote, file):
debug("Comparing filelists (direction: %s -> %s)" % (__direction_str(src_remote), __direction_str(dst_remote)))

for relative_file in src_list.keys():
debug(u"CHECK: %s" % (relative_file))
debug(u"CHECK: '%s'" % relative_file)

if relative_file in dst_list:
## Was --skip-existing requested?
if cfg.skip_existing:
debug(u"IGNR: %s (used --skip-existing)" % (relative_file))
debug(u"IGNR: '%s' (used --skip-existing)" % relative_file)
del(src_list[relative_file])
del(dst_list[relative_file])
continue

try:
same_file = _compare(src_list, dst_list, src_remote, dst_remote, relative_file)
except (IOError,OSError):
debug(u"IGNR: %s (disappeared)" % (relative_file))
warning(u"%s: file disappeared, ignoring." % (relative_file))
debug(u"IGNR: '%s' (disappeared)" % relative_file)
warning(u"%s: file disappeared, ignoring." % relative_file)
del(src_list[relative_file])
del(dst_list[relative_file])
continue

if same_file:
debug(u"IGNR: %s (transfer not needed)" % relative_file)
debug(u"IGNR: '%s' (transfer not needed)" % relative_file)
del(src_list[relative_file])
del(dst_list[relative_file])

Expand All @@ -607,7 +607,7 @@ def _compare(src_list, dst_lst, src_remote, dst_remote, file):
if md5 is not None and md5 in dst_list.by_md5:
# Found one, we want to copy
dst1 = dst_list.find_md5_one(md5)
debug(u"DST COPY src: %s -> %s" % (dst1, relative_file))
debug(u"DST COPY src: '%s' -> '%s'" % (dst1, relative_file))
copy_pairs.append((src_list[relative_file], dst1, relative_file, md5))
del(src_list[relative_file])
del(dst_list[relative_file])
Expand All @@ -629,7 +629,7 @@ def _compare(src_list, dst_lst, src_remote, dst_remote, file):
dst1 = dst_list.find_md5_one(md5)
if dst1 is not None:
# Found one, we want to copy
debug(u"DST COPY dst: %s -> %s" % (dst1, relative_file))
debug(u"DST COPY dst: '%s' -> '%s'" % (dst1, relative_file))
copy_pairs.append((src_list[relative_file], dst1,
relative_file, md5))
del(src_list[relative_file])
Expand Down
2 changes: 1 addition & 1 deletion run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def pbucket(tail):
must_find = ["'testsuite/demo/dir2/file2-1.bin' -> '%s/xyz/demo/dir2/file2-1.bin'" % pbucket(1),
"DEBUG: EXCLUDE: 'testsuite/demo/dir1/'"], # whole directory is excluded
must_not_find = ["'testsuite/demo/dir1/file1-1.txt' -> '%s/xyz/demo/dir1/file1-1.txt'" % pbucket(1),
"DEBUG: EXCLUDE: dir1/file1-1.txt" # file is not synced, but also single file is not excluded
"DEBUG: EXCLUDE: 'dir1/file1-1.txt'" # file is not synced, but also single file is not excluded
])

## ====== Don't Put symbolic link
Expand Down

0 comments on commit d43f30d

Please sign in to comment.