Bug 860368 - mock --scrub=chroot fails with IOError: [Errno 2] No such file or directory: '/var/lib/mock/fedora-rawhide-x86_64/result/state.log'
Summary: mock --scrub=chroot fails with IOError: [Errno 2] No such file or directory: ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-25 17:27 UTC by Sandro Mani
Modified: 2012-11-20 19:36 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-11-15 02:32:09 UTC
Type: Bug


Attachments (Terms of Use)
patch to allow scrub of non-existent chroot (1.11 KB, patch)
2012-10-02 19:47 UTC, Clark Williams
no flags Details | Diff
Simpler patch to handle scrub calls to non-existant chroots (4.43 KB, patch)
2012-10-31 21:35 UTC, Clark Williams
no flags Details | Diff

Description Sandro Mani 2012-09-25 17:27:07 UTC
Description of problem:
After a failed build, mock scrub fails:
$ mock -r fedora-rawhide-x86_64 --scrub=chroot
INFO: mock.py version 1.1.27 starting...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
Start: lock buildroot
Start: scrub ['chroot']
ERROR: [Errno 2] No such file or directory: '/var/lib/mock/fedora-rawhide-x86_64/result/state.log'
Traceback (most recent call last):
  File "/usr/sbin/mock", line 539, in <module>
    def do_buildsrpm(config_opts, chroot, options, args):
  File "/usr/sbin/mock", line 788, in main
    chroot.scrub(options.scrub)
  File "<peak.util.decorators.rewrap wrapping mockbuild.backend.scrub at 0x0294B140>", line 3, in scrub
    def scrub(self, scrub_opts): return __decorated(self, scrub_opts)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/backend.py", line 209, in scrub
    self._resetLogging()
  File "<peak.util.decorators.rewrap wrapping mockbuild.backend._resetLogging at 0x02953F50>", line 3, in _resetLogging
    def _resetLogging(self): return __decorated(self)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/backend.py", line 969, in _resetLogging
    fh = logging.FileHandler(fullPath, "a+")
  File "/usr/lib64/python2.7/logging/__init__.py", line 897, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib64/python2.7/logging/__init__.py", line 916, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 2] No such file or directory: '/var/lib/mock/fedora-rawhide-x86_64/result/state.log'



Version-Release number of selected component (if applicable):
mock-1.1.27-2.fc19.noarch

How reproducible:
Always

Steps to Reproduce:
1. Make a build fail
2. mock -r <profile> --scrub={all|chroot}

Additional info:
Workaround:
mkdir -p /var/lib/mock/fedora-rawhide-x86_64/result/
touch /var/lib/mock/fedora-rawhide-x86_64/result/state.log
mock -r <profile> --scrub=all

Comment 1 Clark Williams 2012-10-02 19:08:30 UTC
Good catch. Looks like the scrub code has places where it presumes the chroot paths exist and when they don't, boom. 

Trying to decide now whether to check for existence of the path and if it's not there just return success or whether I should create the skeleton of the path (/var/lib/mock/fedora-rawhide-x86_64/result in the above case) and let things continue.

Comment 2 Clark Williams 2012-10-02 19:47:10 UTC
Created attachment 620488 [details]
patch to allow scrub of non-existent chroot

Please try the attached patch to make sure it works for your configuration

Comment 3 Clark Williams 2012-10-02 20:03:30 UTC
Ugh, I was too quick on that patch above. seems to be causing failures in my regression test suite. I'll debug this and post a second patch.

Comment 4 Sandro Mani 2012-10-12 19:00:33 UTC
any news?:)

Comment 5 Clark Williams 2012-10-19 13:51:37 UTC
Well, nothing good. I tried to short-circuit the problem in the backend code (in the init method) but I'm seeing a failure in rawhide. 

Unfortunately this has coincided with a rare set of travel for me so I probably won't get back on this until I get back home (this coming Monday).

Comment 6 Clark Williams 2012-10-30 19:34:45 UTC
still looking at it

Comment 7 Clark Williams 2012-10-31 21:35:24 UTC
Created attachment 636369 [details]
Simpler patch to handle scrub calls to non-existant chroots

Put scrub body inside try/except/finally block and issue warning if called on non-existent chroot.

Queued to go out with 1.1.28

Comment 8 Fedora Update System 2012-11-01 21:08:50 UTC
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

Comment 9 Fedora Update System 2012-11-01 21:10:14 UTC
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

Comment 10 Fedora Update System 2012-11-01 21:11:27 UTC
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

Comment 11 Fedora Update System 2012-11-01 21:12:38 UTC
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

Comment 12 Fedora Update System 2012-11-01 21:13:45 UTC
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

Comment 13 Fedora Update System 2012-11-02 18:36:02 UTC
Package mock-1.1.28-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.28-1.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2012-13374/mock-1.1.28-1.el6
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2012-11-15 02:32:10 UTC
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.

Comment 15 Fedora Update System 2012-11-15 02:34:39 UTC
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.

Comment 16 Fedora Update System 2012-11-20 19:36:48 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.