-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't try to overwrite an existing file if the contents are identical #4604
Conversation
dffa4e6
to
601fc4c
Compare
Note that file permissions are not compared as part of
Could this cause problems? |
This is a very good point imho, could result in unintended side effects/breakage? |
@@ -2385,6 +2386,9 @@ def copy_file(path, target_path, force_in_dry_run=False): | |||
target_exists = os.path.exists(target_path) | |||
if target_exists and path_exists and os.path.samefile(path, target_path): | |||
_log.debug("Not copying %s to %s since files are identical", path, target_path) | |||
# Don't copy them if they are already considered the same | |||
elif target_exists and path_exists and os.path.isfile(target_path) and filecmp.cmp(path, target_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the very least we should also check whether file permissions are the same as well before skipping the actual copy operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the permissions may have been changed later on by postinstallcmds or hooks or the normal EB change-permission step and thus permission differences should not be considered if the content is actually the same.
Closing this in favour of #4642 which I think is the real problem |
No description provided.