[Aptitude-devel] Please review: proposed changes to aptitude error reporting

Daniel Hartwig mandyke at gmail.com
Fri Jun 8 14:55:03 BST 2012


Hello all

[BCC to notify prominent respondents on relevant bugs, apologies if
you are no longer interested.]

Issue: if not all actions could be completed, then aptitude should
show errors and exit with non-zero status.

This is bug report #121313 and others.  Aptitude's performance on this
has been pretty poor.

This is different to the request for prompting the user if there were
download errors (see #639789).

Some packages may have installed ok, but if there were some failures
the exit status must be non-zero.

I have worked out a solution to this, the implementation of which is
nearly complete (some minor nuances left).

Effectively, all errors are now reported and the exit status is well-defined:

 0: success
 1: user aborted or no matches (with search, for example)
 2: error, but not fatal; some actions may have been effective
 255: fatal error; no actions effective

This applies to all command line actions, but is not yet working with
--visual-preview.

For example, aptitude install may fail to download some packages but
still manage to install others.  In this case a non-fatal error has
occured (non-fatal because some actions did succeed) and the exit
status is 2.  However, the exit status of 2 does not indicate that any
actions did succeed, only that some may have.

Previously aptitude's exit status was very ad-hoc.  The use of 255 is
to remaining consistent with the current fatal exit status, however, I
believe this should definitely be changed to 100 for consistency with
apt-utils.

The alternative to this, as suggested by one commenter, is to copy
apt-get exit codes:

 0: success or no matches (apt-cache search)
 1: user aborted
 100: any kind of error

This is useful, but does not distinguish between fatal and non-fatal
errors where some actions have succeeded (such as with apt-get install
--fix-missing).

Any comments are greatly appreciated.

Many programs use aptitude but find it unreliable due to the current
poor state of exit status.  I would like to push this out to
experimental as soon as it is complete, get it tested, and give people
time to update their programs to take advantage for Wheezy (ok, maybe
first point release :-).

Regards



More information about the Aptitude-devel mailing list