Skip to content

Commit

Permalink
actually compare file contents in case of permissions error
Browse files Browse the repository at this point in the history
  • Loading branch information
jfgrimm committed Sep 17, 2024
1 parent a198ad5 commit 5d1f2ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion easybuild/tools/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"""
import datetime
import difflib
import filecmp
import glob
import hashlib
import inspect
Expand Down Expand Up @@ -2448,7 +2449,7 @@ def copy_file(path, target_path, force_in_dry_run=False):
if not isinstance(err, PermissionError):
raise EasyBuildError("Failed to copy file %s to %s: %s", path, target_path, err)
# double-check whether the copy actually succeeded
if not os.path.exists(target_path) or not os.path.samefile(path, target_path):
if not os.path.exists(target_path) or not filecmp.cmp(path, target_path, shallow=False):
raise EasyBuildError("Failed to copy file %s to %s: %s", path, target_path, err)
_log.info("%s copied to %s, ignoring permissions error: %s", path, target_path, err)
elif os.path.islink(path):
Expand Down

0 comments on commit 5d1f2ce

Please sign in to comment.