Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-117467: Add preserving of mailbox owner on flush#117510
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ghost commentedApr 3, 2024 • edited by ghost
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by ghost
Uh oh!
There was an error while loading.Please reload this page.
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
serhiy-storchaka left a comment
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.
Since it is a user visible change, it needs a NEWS entry. You can read above how to create it.
Could you please also add a test? It should create a mailbox, change its user and group, modify it, and check that its user and group are preserved. This test can only be run as root, but it is better than nothing.
Lib/mailbox.py Outdated
| os.chmod(new_file.name,info.st_mode) | ||
| try: | ||
| os.chown(new_file.name,info.st_uid,info.st_gid) | ||
| except: |
serhiy-storchakaApr 3, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Silently ignoring arbitrary exceptions is never a good idea. KeyboardInterrupt, MemoryError and RecursionError can be raised by virtually any code.
It is better to make the exception check more specific, for example:(PermissionError, AttributeError).
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
softins commentedApr 3, 2024
Done. Hope it's ok.
As a novice contributor, I will have to work out how to add a test. Is there any tutorial? |
serhiy-storchaka commentedApr 3, 2024
!buildbot BSD |
bedevere-bot commentedApr 3, 2024
🤖 New build scheduled with the buildbot fleet by@serhiy-storchaka for commitc8eb82c 🤖 The command will test the builders whose names match following regular expression: The builders matched are:
|
serhiy-storchaka commentedApr 3, 2024
https://devguide.python.org/testing/run-write-tests/ may help. Usually you find an appropriate file in the |
serhiy-storchaka commentedApr 3, 2024
!buildbot root |
bedevere-bot commentedApr 3, 2024
🤖 New build scheduled with the buildbot fleet by@serhiy-storchaka for commitc8eb82c 🤖 The command will test the builders whose names match following regular expression: The builders matched are:
|
softins commentedApr 3, 2024
That is brilliant, thank you very much indeed! Although I've programmed for decades, Python is still relatively new to me. |
c8eb82c toc78971cCompareserhiy-storchaka commentedApr 4, 2024
Thank you for your contribution@softins. We usually do not use rebase and force push. It makes iterative reviewing more difficult. All consequent changes are just stacked one over other during review, and squashed into a single changeset right before merging. |
Thanks@softins for the PR, and@serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
GH-117537 is a backport of this pull request to the3.12 branch. |
softins commentedApr 4, 2024
Ok, thank you. I'll remember that for any future contributions. |
…17510)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Uh oh!
There was an error while loading.Please reload this page.
Fixes#117467.
Copy owner and group from the old file to the new when rewriting a mailbox. Ignore any failure from
os.chown(), which may be platform-dependent.