From 5d1f2ce7c878992f9219546298731c7d80f860ee Mon Sep 17 00:00:00 2001 From: jfgrimm Date: Tue, 17 Sep 2024 17:24:02 +0100 Subject: [PATCH] actually compare file contents in case of permissions error --- easybuild/tools/filetools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/easybuild/tools/filetools.py b/easybuild/tools/filetools.py index 0d54ed1000..285c290a14 100644 --- a/easybuild/tools/filetools.py +++ b/easybuild/tools/filetools.py @@ -42,6 +42,7 @@ """ import datetime import difflib +import filecmp import glob import hashlib import inspect @@ -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):