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

vartree: update owner and mode on replaced directories #1381

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/portage/dbapi/vartree.py
Original file line number Diff line number Diff line change
Expand Up @@ -5703,6 +5703,15 @@ def mergeme(
):
# a symlink to an existing directory will work for us; keep it:
showMessage(f"--- {mydest}/\n")
# update owner and mode on existing directories
if stat.S_ISDIR(mydmode):
if (
mydstat.st_uid != mystat.st_uid
or mydstat.st_gid != mystat.st_gid
):
os.chown(mydest, mystat[4], mystat[5])
Copy link
Author

Choose a reason for hiding this comment

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

this and the later chown can probably be done unconditionally, maybe even for symlinks

the code is already pretty wild and hard to read

but for now i opted for a conservative way where addition warning prints could be added

Copy link
Author

Choose a reason for hiding this comment

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

should be rebased on top of #1382 and not use magic numbers

if mydmode != mymode:
os.chmod(mydest, mystat[0])
if bsd_chflags:
bsd_chflags.lchflags(mydest, dflags)
else:
Expand Down