atomic_move - fix preserving the dest attributes when using a tmp file#83986
Draft
s-hertel wants to merge 2 commits intoansible:develfrom
Draft
atomic_move - fix preserving the dest attributes when using a tmp file#83986s-hertel wants to merge 2 commits intoansible:develfrom
s-hertel wants to merge 2 commits intoansible:develfrom
Conversation
b683b5d to
f666b97
Compare
bcoca
reviewed
Sep 24, 2024
| if dest_stat and (tmp_stat.st_uid != dest_stat.st_uid or tmp_stat.st_gid != dest_stat.st_gid): | ||
| os.chown(b_tmp_dest_name, dest_stat.st_uid, dest_stat.st_gid) | ||
| if dest_stat: | ||
| shutil.copystat(b_dest, b_tmp_dest_name) |
Member
There was a problem hiding this comment.
i had encountered this in my 'copy fix', but simplified it by just making it:
if keep_dest_attrs and dest_stat:
|
I've tested patch, and it seems doesn't fix bug #83972 for me. |
Member
|
I am aware, but while debugging that issue i found many more. This PR started by getting the correct settings through each part of the process, the original issue is caused by the 2 final steps, which i have not had time to fix yet. |
f666b97 to
b1ccb37
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Fixes #83972
This looks like a long term bug, though #82818 (2.17+) impacted it. The fix is just adding
shutil.copystatbefore attempting the final rename.In the test case I added, the mode is expected to remain "0664". In 2.17 and later, the mode is "0654". In 2.16 and earlier, the mode is "0644".
ISSUE TYPE