Skip to content

Commit db64d46

Browse files
praiskupxsuchy
authored andcommitted
Only change home files ownership for --rebuild mode
Changing ownership of the entire $HOME directory tree is sometimes an expensive task and a no-op anyway because there's typically no reason for files with the wrong ownership to appear. Let's stop doing it to make the subsequent mock --chroot calls faster and more predictable. In other words, if users want to shoot themselves in the foot and give the files in '/builddir' away (e.g., using "privileged" --chroot calls), Mock will no longer fix the ownership problems. We only continue to fix the permissions for the --rebuild mode, which shouldn't be expensive (because there are pre-build cleanups) and seems important enough to risk changing. Suggested by @kdudka in #1257.
1 parent 27dde5d commit db64d46

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mock/py/mockbuild/buildroot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ def _init(self, prebuild):
348348

349349
# Change owner of homdir tree if the root of it not owned
350350
# by the current user
351-
self.chown_home_dir()
351+
if prebuild:
352+
self.chown_home_dir()
352353

353354
# mark the buildroot as initialized
354355
file_util.touch(self.make_chroot_path('.initialized'))

0 commit comments

Comments
 (0)