Skip to content
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

Fix file.replace mtime update on no changes #61744

Merged
merged 3 commits into from Mar 16, 2022

Conversation

nicholasmhughes
Copy link
Collaborator

@nicholasmhughes nicholasmhughes commented Mar 1, 2022

What does this PR do?

This PR reintroduces the fix from #56359 which was reverted (inadvertently?) in #56621

What issues does this PR fix or reference?

Fixes: #61743

Previous Behavior

File mtime always updated when the pattern doesn't match the replacement value.

New Behavior

File mtime only updated when the content changes.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@nicholasmhughes nicholasmhughes requested a review from a team as a code owner March 1, 2022 14:07
@nicholasmhughes nicholasmhughes requested review from twangboy and removed request for a team March 1, 2022 14:07
@nicholasmhughes
Copy link
Collaborator Author

re-run pr-debian-9-amd64-py3-pytest

@nicholasmhughes
Copy link
Collaborator Author

re-run pr-arch-lts-x86_64-py3-pytest

@Ch3LL
Copy link
Contributor

Ch3LL commented Mar 8, 2022

@waynew can you review since you were the author of #56621

@Ch3LL Ch3LL requested review from waynew and removed request for twangboy March 8, 2022 20:12
Copy link
Contributor

@waynew waynew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find! I went back to double check, and it looks like that was an inadvertent change, and lacking test coverage it wasn't caught 🙃

Just to be on the safe side I pulled this down and banged on it a bit. I couldn't make things break without actually breaking things. This looks like a good fix - it could be spelled differently but I think that's just a matter of taste.

👍

salt/modules/file.py Show resolved Hide resolved
@Ch3LL Ch3LL merged commit 51bebd9 into saltstack:master Mar 16, 2022
@nicholasmhughes nicholasmhughes deleted the fix-file-replace-modify branch March 16, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] file.replace updates the mtime for a file with no changes
3 participants