Bug 669733

Summary: mock trying to chown/chmod files outside of chroot
Product: [Fedora] Fedora Reporter: Jason Harvey <madasafan>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: dcantrell, mebrown, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mock-1.1.10-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 04:38:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch for backend.py to keep it within the chroot none

Description Jason Harvey 2011-01-14 15:10:09 UTC
Created attachment 473542 [details]
Patch for backend.py to keep it within the chroot

If the /builddir/build/ exists in the real root then mock init and rebuild actions fail with 

ERROR: [Errno 1] Operation not permitted: '/builddir/build'

This occurs in mock-1.1.7-1.fc14.noarch

How reproducible: 100%, create 

Steps to Reproduce:
1. as root mkdir -p /builddir/build/something
2. as mock user /usr/bin/mock --init -r fedora-14-x86_64
  
Actual results:

ERROR: [Errno 1] Operation not permitted: '/builddir/build'

Additional info:

Patch attached for backend.py to add the path to the chroots root.

Comment 1 Fedora Admin XMLRPC Client 2011-03-11 18:10:23 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 2 Clark Williams 2011-05-06 20:06:08 UTC
I've queued up the following change:

@@ -832,7 +817,7 @@ class Root(object):
                 mock.util.mkdirIfAbsent(subdir)
 
             # change ownership so we can write to build home dir
-            for (dirpath, dirnames, filenames) in os.walk(self.homedir):
+            for (dirpath, dirnames, filenames) in os.walk(self.makeChrootPath(self.homedir)):
                 for path in dirnames + filenames:
                     os.chown(os.path.join(dirpath, path), self.chrootuid, -1)
                     os.chmod(os.path.join(dirpath, path), 0755)

This uses the method makeChrootPath() for homedir, which does the same thing your patch does. Should be out in the next release (1.1.10/1.0/17)

Comment 3 Fedora Update System 2011-05-13 20:32:41 UTC
mock-1.1.10-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc15

Comment 4 Fedora Update System 2011-05-13 20:37:42 UTC
mock-1.1.10-1.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc14

Comment 5 Fedora Update System 2011-05-13 20:41:58 UTC
mock-1.0.17-1.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/mock-1.0.17-1.el5

Comment 6 Fedora Update System 2011-05-13 20:46:13 UTC
mock-1.1.10-1.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.fc13

Comment 7 Fedora Update System 2011-05-13 20:50:30 UTC
mock-1.1.10-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.1.10-1.el6

Comment 8 Fedora Update System 2011-05-14 00:02:37 UTC
Package mock-1.1.10-1.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing mock-1.1.10-1.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/mock-1.1.10-1.el6
then log in and leave karma (feedback).

Comment 9 Jason Harvey 2011-05-15 12:29:21 UTC
Thanks Clark, I tested mock-1.1.10-1.fc15 and all looks good with it now.

I created an account on fedoraproject and believe I added a point of karma :)

Regards,
Jason

Comment 10 Fedora Update System 2011-05-19 04:34:11 UTC
mock-1.1.10-1.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2011-05-25 02:41:31 UTC
mock-1.1.10-1.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2011-05-25 03:15:58 UTC
mock-1.1.10-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2011-06-02 19:05:43 UTC
mock-1.0.17-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2011-06-02 19:15:46 UTC
mock-1.1.10-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.