Skip to content

Commit

Permalink
always set ownership of homedir (but not recursively)
Browse files Browse the repository at this point in the history
Not setting the ownership caused problem when doing
  mock -r fedora-rawhide-x86_64 --chroot --unpriv "touch ~/test"
lets make sure that homedir is always writable but keep the recursion only in rebuild as was previously.

Fixes: rpm-software-management#1364
  • Loading branch information
xsuchy authored and praiskup committed Apr 25, 2024
1 parent 7b40a26 commit b9d77f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mock/py/mockbuild/buildroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ def _init(self, prebuild):
# by the current user
if prebuild:
self.chown_home_dir()
else:
self.chown_home_dir(recursive=False)

# mark the buildroot as initialized
file_util.touch(self.make_chroot_path('.initialized'))
Expand Down Expand Up @@ -678,10 +680,10 @@ def _setup_dirs(self):
file_util.mkdirIfAbsent(self.make_chroot_path(item))

@traceLog()
def chown_home_dir(self):
def chown_home_dir(self, recursive=True):
""" set ownership of homedir and subdirectories to mockbuild user """
self.uid_manager.changeOwner(self.make_chroot_path(self.homedir),
recursive=True)
recursive=recursive)

@traceLog()
def prepare_installation_time_homedir(self):
Expand Down
7 changes: 7 additions & 0 deletions releng/release-notes-next/chown-homedir.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
In the [issue#1257][] it was suggested that we do not change recursively
ownership every run. This was implemented and landed in Mock 5.5.
But in the [issue#1364][] we found that for fresh chroots the homedir
is not writable for unpriv user.
We changed the behaviour that ownership of homedir is changed always (that was
a behaviour prior 5.5 release) and the ownership is changed recursively only for
rebuilds.

0 comments on commit b9d77f4

Please sign in to comment.