From b9d77f4e89af3202c1f8fb6c104ff2bdb2383ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Such=C3=BD?= Date: Wed, 24 Apr 2024 09:35:10 +0200 Subject: [PATCH] always set ownership of homedir (but not recursively) 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: #1364 --- mock/py/mockbuild/buildroot.py | 6 ++++-- releng/release-notes-next/chown-homedir.bugfix | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 releng/release-notes-next/chown-homedir.bugfix diff --git a/mock/py/mockbuild/buildroot.py b/mock/py/mockbuild/buildroot.py index 94c9decb5..f81919518 100644 --- a/mock/py/mockbuild/buildroot.py +++ b/mock/py/mockbuild/buildroot.py @@ -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')) @@ -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): diff --git a/releng/release-notes-next/chown-homedir.bugfix b/releng/release-notes-next/chown-homedir.bugfix new file mode 100644 index 000000000..8b634f4c1 --- /dev/null +++ b/releng/release-notes-next/chown-homedir.bugfix @@ -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.