Exit code not set on error

Bug #113085 reported by Benji York
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Buildout
Confirmed
Undecided
Unassigned

Bug Description

When the buildout exits with an error, it should return a non-zero value. It doesn't appear to do so now. The specific occurrance I'm seeing is when paramiko raises an AuthenticationException error.

Jim Fulton (jim-zope)
Changed in zc.buildout:
status: Unconfirmed → Fix Committed
Revision history for this message
Jim Fulton (jim-zope) wrote :

Note that this only affected internal errors (e.g. bugs in recipes).

User errors se the exist code correctly.

Jim Fulton (jim-zope)
Changed in zc.buildout:
status: Fix Committed → Fix Released
Revision history for this message
Marius Gedminas (mgedmin) wrote :

I still see this problem with zc.buildout 1.1.0:

Upgraded:
  zc.buildout version 1.1.0;
restarting.
Generated script '/home/user/src/package/bin/buildout'.
Updating test.
While:
  Updating test.
  Getting distribution for 'plastex'.

An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
...
  File "/usr/lib/python2.5/httplib.py", line 349, in _read_status
    raise BadStatusLine(line)
BadStatusLine
program finished with exit code 0

(The "program finished with exit code 0" line comes from buildbot logs; because of the exit code buildbot thinks everything was fine and tries to run the next step, which fails because bin/test doesn't exist.)

Changed in zc.buildout:
status: Fix Released → New
Revision history for this message
Marius Gedminas (mgedmin) wrote :

Okay, this is extremely weird. I can see the sys.exit(1) call in buildout sources on that machine, right after the internal error message is printed. Could the logging.shutdown() call in the finally: block somehow clear that exception? Nothing else comes to mind...

Revision history for this message
Sidnei da Silva (sidnei) wrote :

I can confirm this is still the problem with the latest 1.2.1 release.

Changed in zc.buildout:
status: New → Confirmed
Revision history for this message
Patrick Gerken (do3cc) wrote :

I traced it a bit more today, and these were my findings:

- It does only happen when buildout shall be used with a different buildout version, and buildout upgrades the zc.buildout, and restarts itself.
- In zc.buildout.buildout._maybe_upgrade the new version is called, and this one correctly returns the exit code one because of a failure. _maybe_upgrade calls sys.exit() with the correct exit code
- The Exception bubbles up the stack until zc.buildout.buildout.main, here the exceptions SystemExit are being catched and ignored

I don't know why SystemExit gets swallowed here, I only know it happened then:

http://zope3.pov.lt/trac/changeset/73082

As I don't understand the reasons good enough, I just post my findings here.

Revision history for this message
Patrick Gerken (do3cc) wrote :

I have created a branch that does not catch the SystemError any longer. This resulted in some errors during an update that I also fixed. I'd be really happy if somebody could review it so that it gets released soon. It will make a lot of failing buildouts happy, because they'll fail at the right step.
The branch is here:
svn+ssh://svn.zope.org/repos/main/zc.buildout/branches/do3cc_exitcode

Revision history for this message
Domen Kožar (ielectric+) wrote :

This *should* be fixed in zc.buildout 1.6.0, can someone verify?

Revision history for this message
Patrick Gerken (do3cc) wrote :

We should see this soonishly with the automated buildbots.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.