Skip to content

[master] Make file.manage_file permission, user and group atomic - #65657

Open
m-czernek wants to merge 3 commits into
saltstack:masterfrom
m-czernek:mczernek/file_perm_enhance
Open

[master] Make file.manage_file permission, user and group atomic#65657
m-czernek wants to merge 3 commits into
saltstack:masterfrom
m-czernek:mczernek/file_perm_enhance

Conversation

@m-czernek

@m-czernek m-czernek commented Dec 1, 2023

Copy link
Copy Markdown
Contributor

What does this PR do?

In this PR, I tweak the internal behavior of file.manage_file to improve the file permission and owner consistency while the function is executing. See the linked PR for discussion of why this might be useful to users.

In the end, while modifying the code, I found this approach to be the simplest and cleanest; however, I am open to discussions and modifying the approach.

What issues does this PR fix or reference?

Fixes: #65651

Previous Behavior

When the module copied a file, the file temporarily used the 600 perms with the user of the current running process.

New Behavior

Currently, the module attempts to modify the basic file attributes as soon as the file is copied to minimize the risk of race conditions.

Merge requirements satisfied?

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

Commits signed with GPG?

Yes

@m-czernek
m-czernek requested a review from a team as a code owner December 1, 2023 10:25
@m-czernek
m-czernek requested review from felippeb and removed request for a team December 1, 2023 10:25
@welcome

welcome Bot commented Dec 1, 2023

Copy link
Copy Markdown

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@salt-project-bot-prod-environment salt-project-bot-prod-environment Bot changed the title Make file.manage_file permission, user and group atomic [master] Make file.manage_file permission, user and group atomic Dec 1, 2023
@dwoz dwoz added this to the Argon v3008.0 milestone Dec 18, 2023
@m-czernek

m-czernek commented Feb 13, 2024

Copy link
Copy Markdown
Contributor Author

Ping @dwoz @felippeb, any chance for a review? :)

@dwoz
dwoz requested a review from a team as a code owner March 16, 2025 22:09

@twangboy twangboy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please create a changelog and write a test for this. Since this is such a heavily used module, we need to make sure it is well tested.

Comment thread salt/utils/files.py Outdated
@twangboy twangboy modified the milestones: Argon v3008.0, Argon v3008.1 Jun 5, 2026
@dwoz
dwoz force-pushed the mczernek/file_perm_enhance branch from 294cde5 to 08c1a3e Compare June 16, 2026 04:43
@dwoz dwoz modified the milestones: Argon v3008.1, Potassium v3009.0 Jun 16, 2026
@dwoz dwoz removed the needs-testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases label Jun 16, 2026
twangboy
twangboy previously approved these changes Jul 2, 2026
@twangboy

twangboy commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Please rebase and address conflicts

@m-czernek

Copy link
Copy Markdown
Contributor Author

PR rebased, should be mergeable now.

@twangboy

Copy link
Copy Markdown
Contributor

Test failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][DISCUSSION] file.manage_file might cause race condition due to permission config

4 participants