Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 649192
Summary: | mock-1.1.6 doesn't play along with users $HOME on a NFS share (ERROR: Cannot find/open srpm) | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Erik Wasser <fuzz> | ||||
Component: | mockobjects | Assignee: | Clark Williams <williams> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | low | ||||||
Version: | rawhide | CC: | mebrown, number.cruncher, rdieter, williams | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2012-11-15 02:32:35 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
Erik Wasser
2010-11-03 06:58:06 UTC
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component. I've just hit the same problem. Created attachment 489975 [details]
Patch to avoid the error message (tested with 1.1.6 and 1.1.9)
After the update to mock 1.1.9 the bug is still their. So I'm sending in this small little patch.
The patch will just do a 'os.chdir("/")' before the tar call. I'm using mock very often and havn't detected any side effects so I think it's safe to use.
Thanks Erik, I'm slowly working on 1.1.10, so I'll add it to the queue. I modified this logic a bit to conditionally do the chdir: ommit e04b7d8a52a2bb88496545593898c744d2e8c8af Author: Clark Williams <williams> Date: Thu Aug 23 14:12:13 2012 -0500 deal with NFS home directories and root_cache issues [BZ# 649192] Detect if we're running on an NFS home and if so chdir to a non-NFS directory so tar doesn't freak out when unpacking the chroot cache. Signed-off-by: Clark Williams <williams> diff --git a/py/mockbuild/plugins/root_cache.py b/py/mockbuild/plugins/root_cache.py index da17162..bcbd6b3 100644 --- a/py/mockbuild/plugins/root_cache.py +++ b/py/mockbuild/plugins/root_cache.py @@ -95,6 +95,11 @@ class RootCache(object): if os.path.exists(self.rootCacheFile) and self.rootObj.chrootWasCleaned: self.rootObj.start("unpacking root cache") self._rootCacheLock() + # + # deal with NFS homedir and root_squash + # + if mockbuild.util.get_fs_type(os.getcwd()).startswith('nfs'): + os.chdir(mockbuild.util.find_non_nfs_dir()) mockbuild.util.do( ["tar"] + self.compressArgs + ["-xf", self.rootCacheFile, "-C", self.rootObj.makeChrootPath()], shell=False diff --git a/py/mockbuild/util.py b/py/mockbuild/util.py index 62da296..07c52d0 100644 --- a/py/mockbuild/util.py +++ b/py/mockbuild/util.py @@ -411,3 +411,16 @@ def clean_env(): } env['LANG'] = os.environ.setdefault('LANG', 'en_US.UTF-8') return env + +def get_fs_type(path): + cmd = '/usr/bin/stat -f -L -c %%T %s' % path + p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + p.wait() + return p.stdout.readline().strip() + +def find_non_nfs_dir(): + dirs = ('/tmp', '/usr/tmp', '/') + for d in dirs: + if not get_fs_type(d).startswith('nfs'): + return d + raise mockbuild.exception.Error('Cannot find non-NFS directory in: %s' % dirs) will be in the next build. I've modified the patch a bit to be conditional: Author: Clark Williams <williams> Date: Thu Aug 23 14:12:13 2012 -0500 deal with NFS home directories and root_cache issues [BZ# 649192] Detect if we're running on an NFS home and if so chdir to a non-NFS directory so tar doesn't freak out when unpacking the chroot cache. Signed-off-by: Clark Williams <williams> diff --git a/py/mockbuild/plugins/root_cache.py b/py/mockbuild/plugins/root_cache.py index da17162..bcbd6b3 100644 --- a/py/mockbuild/plugins/root_cache.py +++ b/py/mockbuild/plugins/root_cache.py @@ -95,6 +95,11 @@ class RootCache(object): if os.path.exists(self.rootCacheFile) and self.rootObj.chrootWasCleaned: self.rootObj.start("unpacking root cache") self._rootCacheLock() + # + # deal with NFS homedir and root_squash + # + if mockbuild.util.get_fs_type(os.getcwd()).startswith('nfs'): + os.chdir(mockbuild.util.find_non_nfs_dir()) mockbuild.util.do( ["tar"] + self.compressArgs + ["-xf", self.rootCacheFile, "-C", self.rootObj.makeCh shell=False diff --git a/py/mockbuild/util.py b/py/mockbuild/util.py index 62da296..07c52d0 100644 --- a/py/mockbuild/util.py +++ b/py/mockbuild/util.py @@ -411,3 +411,16 @@ def clean_env(): } env['LANG'] = os.environ.setdefault('LANG', 'en_US.UTF-8') return env + +def get_fs_type(path): + cmd = '/usr/bin/stat -f -L -c %%T %s' % path + p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + p.wait() + return p.stdout.readline().strip() + +def find_non_nfs_dir(): + dirs = ('/tmp', '/usr/tmp', '/') + for d in dirs: + if not get_fs_type(d).startswith('nfs'): + return d + raise mockbuild.exception.Error('Cannot find non-NFS directory in: %s' % dirs) Should go into the next build mock-1.1.27-2.el6 has been submitted as an update for Fedora EPEL 6. https://admin.fedoraproject.org/updates/mock-1.1.27-2.el6 mock-1.1.27-2.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/mock-1.1.27-2.fc16 mock-1.0.35-1.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/mock-1.0.35-1.el5 mock-1.1.27-2.fc17 has been submitted as an update for Fedora 17. https://admin.fedoraproject.org/updates/mock-1.1.27-2.fc17 Package mock-1.1.27-2.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.27-2.el6' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-EPEL-2012-12915/mock-1.1.27-2.el6 then log in and leave karma (feedback). mock-1.1.28-1.el6 has been submitted as an update for Fedora EPEL 6. https://admin.fedoraproject.org/updates/mock-1.1.28-1.el6 mock-1.1.28-1.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/mock-1.1.28-1.fc18 mock-1.0.36-1.el5 has been submitted as an update for Fedora EPEL 5. https://admin.fedoraproject.org/updates/mock-1.0.36-1.el5 mock-1.1.28-1.fc17 has been submitted as an update for Fedora 17. https://admin.fedoraproject.org/updates/mock-1.1.28-1.fc17 mock-1.1.28-1.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/mock-1.1.28-1.fc16 mock-1.1.28-1.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report. mock-1.1.28-1.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report. mock-1.0.36-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. I'm seeing what seems to be an odd-side effect from this change, mock ... ./foo.src.rpm now fails for me (when issued on an nfs dir), Finish: clean chroot Finish: lock buildroot ERROR: [Errno 2] No such file or directory: './kdelibs-4.9.90-1.fc19.src.rpm' Traceback (most recent call last): File "/usr/sbin/mock", line 920, in <module> main(retParams) File "/usr/sbin/mock", line 856, in main do_rebuild(config_opts, chroot, args) File "<peak.util.decorators.rewrap wrapping __main__.do_rebuild at 0x01E71CF8>", line 3, in do_rebuild but mock ... /full/path/to/foo.src.rpm works. $ rpm -q mock mock-1.1.28-1.el6.noarch by the way |