Fix safe_copy(..., preserve_meta=False)#4938
Fix safe_copy(..., preserve_meta=False)#4938samsrabin wants to merge 11 commits intoESMCI:masterfrom
Conversation
The failing test is test_safe_copy_preserve_meta_false: According to the docstring, we do not expect permissions to be preserved when using safe_copy() on a file, but they are.
6023ccd to
672d495
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4938 +/- ##
==========================================
- Coverage 31.37% 28.35% -3.03%
==========================================
Files 264 262 -2
Lines 38899 38362 -537
Branches 8260 8116 -144
==========================================
- Hits 12204 10876 -1328
- Misses 25457 26245 +788
- Partials 1238 1241 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hmm... not sure what that failing CESM system test is about. |
|
Very strange; it works on Derecho. Resubmitting. |
|
That did it! All tests have now passed. |
|
In my testing on Izumi, all CTSM baseline files now have at least |
There was a problem hiding this comment.
Pull request overview
Fixes safe_copy(..., preserve_meta=False) so that direct file copies do not accidentally preserve permissions (allowing SharedArea’s umask behavior to take effect as intended).
Changes:
- Switch direct file copy behavior for
preserve_meta=Falsefromshutil.copytoshutil.copyfile(avoid copying mode bits). - Add a new unit test module covering
safe_copybehavior acrosspreserve_metasettings and within/outsideSharedArea.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
CIME/utils.py |
Updates safe_copy to avoid preserving permissions when preserve_meta=False for new direct-file copies. |
CIME/tests/test_unit_safe_copy.py |
Adds unit tests intended to catch permission/umask regressions and validate SharedArea interactions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
A specific umask was actually already set. This reverts commit 9ca2be7.
|
@rljacob Could you request a Claude re-review? |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…se behavior. * Ensure that test descriptions match behavior. * Ensure that calling umask is different from both src and tgt files.
|
@jedwards4b @rljacob I think this is ready to go! |
Description
This changes
safe_copy(..., preserve_meta=False)to useshutil.copyfileinstead ofshutil.copywhensafe_copyis called on a file directly. This fixes the bug wherepreserve_meta=Falseincorrectly preserved permissions.The first set of test runs will fail because I'm pushing without the bugfix. Once those tests are complete, I'll push the fix and they should pass.
I added the tests in a new file, but they could be moved to test_unit_utils.py instead.
Checklist