Skip to content

Fix os.rename permission check for the root user - #1342

Merged
mrbean-bremen merged 1 commit into
pytest-dev:mainfrom
tchaikov:wip-1341-root-rename
Sep 22, 2026
Merged

mrbean-bremen merged 1 commit into
pytest-dev:mainfrom
tchaikov:wip-1341-root-rename

Conversation

@tchaikov

Copy link
Copy Markdown
Contributor

Describe the changes

The related issue or a description of the bug or feature that this PR addresses.

Tasks

  • Unit tests added that reproduce the issue or prove feature is working
  • Fix or feature added
  • Entry to release notes added
  • Pre-commit CI shows no errors
  • Unit tests passing
  • For documentation changes: The Read the Docs preview builds and looks as expected

- lresolve() was the only permission check without an is_root() test,
  so root could not rename an entry in a directory of another user
- regression from pytest-dev#961, where the plain mode check was replaced by
  has_permission(), which also considers the owner
- fixes pytest-dev#1341

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
@tchaikov
tchaikov force-pushed the wip-1341-root-rename branch from 25cbd0b to 6a3bbed Compare September 22, 2026 09:16

@mrbean-bremen mrbean-bremen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, looks good!
The failing tests are another problem, some flaky tests with the new macOS version...

@mrbean-bremen
mrbean-bremen merged commit 796c48e into pytest-dev:main Sep 22, 2026
102 of 104 checks passed
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.

os.rename fails with PermissionError when the parent directory belongs to another user

2 participants