Bug 835633 - "ERROR: state finish mismatch" when exiting mock --shell
"ERROR: state finish mismatch" when exiting mock --shell
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: mock (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Clark Williams
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-26 12:37 EDT by Ville Skyttä
Modified: 2012-11-20 14:36 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-11-14 21:32:19 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
[PATCH] fix state start/finish mismatch in --chroot (822 bytes, patch)
2012-08-21 23:06 EDT, Mathieu Bridon
no flags Details | Diff
[PATCH] fix state start/finish mismatch on 'device setup' (5.70 KB, patch)
2012-09-04 05:09 EDT, Mathieu Bridon
no flags Details | Diff
[PATCH] Handle failures in the various setups before --shell (1.24 KB, patch)
2012-09-04 05:11 EDT, Mathieu Bridon
no flags Details | Diff
[PATCH] fix state start/finish mismatch when 'rpmbuild -bs' fails (2.02 KB, patch)
2012-09-04 06:40 EDT, Mathieu Bridon
no flags Details | Diff

  None (edit)
Description Ville Skyttä 2012-06-26 12:37:59 EDT
With current mock upstream git master:

$ mock --shell
INFO: mock.py version unreleased_version starting...
[...]
Start: shell
<mock-chroot>[root@box /]# exit
logout
ERROR: state finish mismatch: current: shell, state: lock buildroot

I suppose the error message is bogus or something forgets to set a state somewhere.
Comment 1 Clark Williams 2012-06-29 11:14:18 EDT
Yes, sorry I just caught this. It's a bogus error and I have the fix queued for the next release.
Comment 2 Mathieu Bridon 2012-08-21 23:06:03 EDT
Created attachment 606100 [details]
[PATCH] fix state start/finish mismatch in --chroot

The same problem happens with --chroot:
    $ mock --chroot ls
    INFO: mock.py version 1.1.26 starting...
    [... snip ...]
    ERROR: state finish mismatch: current: chroot ls, state: lock buildroot

Attached patch is similar to the Git commit which fixed the error with --shell (ff524a6713538299463c6553d965b5af6193b1fa)
Comment 3 Clark Williams 2012-08-23 15:34:05 EDT
(In reply to comment #2)
> Created attachment 606100 [details]
> [PATCH] fix state start/finish mismatch in --chroot
> 
> The same problem happens with --chroot:
>     $ mock --chroot ls
>     INFO: mock.py version 1.1.26 starting...
>     [... snip ...]
>     ERROR: state finish mismatch: current: chroot ls, state: lock buildroot
> 
> Attached patch is similar to the Git commit which fixed the error with
> --shell (ff524a6713538299463c6553d965b5af6193b1fa)

Applied to my git tree and will show up in the next release.
Comment 4 Trond H. Amundsen 2012-08-29 09:42:11 EDT
I don't know if this is related, but I've encountered something similar on my F17 build host in our local Koji installation (using 1.1.26-2.fc17):

ERROR: state finish mismatch: current: chroot ['make', 'sources'], state: lock buildroot

It fails in SRPM build while doing 'make sources' on a Makefile that only contains this:

sources:
        @echo "Nothing to do here..."

I've been trying older mock versions and the latest that works for me is mock-1.1.22-2.1.fc17.
Comment 5 Clark Williams 2012-08-29 14:06:33 EDT
(In reply to comment #4)
> I don't know if this is related, but I've encountered something similar on
> my F17 build host in our local Koji installation (using 1.1.26-2.fc17):
> 
> ERROR: state finish mismatch: current: chroot ['make', 'sources'], state:
> lock buildroot

Yes, this is probably what you're hitting.
Comment 6 Mathieu Bridon 2012-09-04 04:02:59 EDT
(for some reason I wasn't CC-ed on this bug even though I commented, so I never received your reply)

(In reply to comment #3)
> (In reply to comment #2)
> > Created attachment 606100 [details]
> > [PATCH] fix state start/finish mismatch in --chroot
> > 
> > The same problem happens with --chroot:
> >     $ mock --chroot ls
> >     INFO: mock.py version 1.1.26 starting...
> >     [... snip ...]
> >     ERROR: state finish mismatch: current: chroot ls, state: lock buildroot
> > 
> > Attached patch is similar to the Git commit which fixed the error with
> > --shell (ff524a6713538299463c6553d965b5af6193b1fa)
> 
> Applied to my git tree and will show up in the next release.

First, I can't find the commit in the upstream Git tree. Did you apply verbatim or did you change something? (I'm asking because I rebuild mock with this patch applied, so if I got something wrong it would be nice to know :)

Also, I found another instance of the same bug: _setupDev() doesn't try/catch, so any exception it raises is raised to the caller (e.g shell() ).

So the self.finish("device setup") never gets called (because it's at the end of _setupDev(), after the exception has been raised), and instead the caller catches the exception and tries to finish its own state (e.g self.finish("shell") ), causing the mismatch.

I'll try to cook up a patch to fix it soon.
Comment 7 Mathieu Bridon 2012-09-04 05:09:07 EDT
Created attachment 609603 [details]
[PATCH] fix state start/finish mismatch on 'device setup'

This fixes the problem I described in comment 6.
Comment 8 Mathieu Bridon 2012-09-04 05:11:24 EDT
Created attachment 609604 [details]
[PATCH] Handle failures in the various setups before --shell

While the previous patch fixes the issue I described in comment 6, it only lets mock to fail on yet another start/finish mismatch later on, which this patch fixes.
Comment 9 Mathieu Bridon 2012-09-04 06:40:48 EDT
Created attachment 609624 [details]
[PATCH] fix state start/finish mismatch when 'rpmbuild -bs' fails

And one more state mismatch issue.

This one appears when building the srpm fails, for example if you forget to commit/push patches which are referenced in the spec file.
Comment 10 Clark Williams 2012-09-06 14:33:14 EDT
(In reply to comment #6)
> First, I can't find the commit in the upstream Git tree. Did you apply
> verbatim or did you change something? (I'm asking because I rebuild mock
> with this patch applied, so if I got something wrong it would be nice to
> know :)
> 

Did you look in the 'work' branch? That is where I do stuff before commiting to a build. Of course it's entirely possible that I hadn't pushed it back to the origin...


> Also, I found another instance of the same bug: _setupDev() doesn't
> try/catch, so any exception it raises is raised to the caller (e.g shell() ).
> 
> So the self.finish("device setup") never gets called (because it's at the
> end of _setupDev(), after the exception has been raised), and instead the
> caller catches the exception and tries to finish its own state (e.g
> self.finish("shell") ), causing the mismatch.
> 
> I'll try to cook up a patch to fix it soon.

I applied the three patches from #c7, #c8 and *c9 to my tree and have pushed it to the main git tree (still in the work branch).
Comment 11 Fedora Update System 2012-09-14 11:26:46 EDT
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
Comment 12 Fedora Update System 2012-09-14 11:28:01 EDT
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
Comment 13 Fedora Update System 2012-09-14 11:28:59 EDT
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
Comment 14 Fedora Update System 2012-09-14 11:29:53 EDT
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
Comment 15 Fedora Update System 2012-09-16 14:28:59 EDT
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).
Comment 16 Fedora Update System 2012-11-01 17:08:57 EDT
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 17 Fedora Update System 2012-11-01 17:10:21 EDT
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 18 Fedora Update System 2012-11-01 17:11:33 EDT
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 19 Fedora Update System 2012-11-01 17:12:44 EDT
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 20 Fedora Update System 2012-11-01 17:13:51 EDT
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 21 Fedora Update System 2012-11-14 21:32:21 EST
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 22 Fedora Update System 2012-11-14 21:34:46 EST
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 23 Fedora Update System 2012-11-20 14:36:56 EST
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.