[Aptitude-devel] Bug#822560: aptitude: Pressing "q" to quit after installation leaves a black terminal

Manuel A. Fernandez Montecelo manuel.montezelo at gmail.com
Sat May 14 10:11:55 UTC 2016


Hi,

2016-05-12 20:53 Josh Triplett:
>Package: aptitude
>Followup-For: Bug #822560
>
>I understand that aptitude needs to save some state information when
>quitting.  However, why does aptitude need to re-open the full UI just
>to close it, rather than printing an indication about saving state and
>then quitting directly from the text output back to the shell?  aptitude
>already needs to properly transition from curses mode back to text mode
>when invoking dpkg.

As explained in the changelog:

  * [curses] Be more verbose when quitting after dpkg actions (Closes: #822560)

    This is related to the fix in the previous version for #246672.

    Make curses windows visible when restoring (instead of staying blank) to
    show message of "Updating state and shutting down", and make some
    improvements to speed up shut down.

    The optimisation is achieved through a global variable shutdown_in_progress
    that apt_load_cache() pays attention to, to e.g. avoid re-loading tags.
    This mechanism is not very elegant, but:

    a) we cannot quit directly (we need to save the state after package
       actions were taken, for example), and

    b) untangling the rest of the shutdown process is very difficult, with the
       state of the code having grown organically for years without taking this
       into account (it would need significant rewrites); and duplicating code
       for the cases when we quit and we continue is not very good either


The UI is driven by events, signals and slots and all that, and uses
different threads.  When dpkg runs the UI is merely suspended, not
closed.  IOW, it's not a simple transition from curses to console,
aptitude UI is much more complex than just using curses.

The code used for reading the state and acting upon is the same as when
starting the UI and when continuing after suspending, and entangled with
these event handlers.

So even if it was desired (unclear at this point), it's not a simple
thing to do.


Cheers.
-- 
Manuel A. Fernandez Montecelo <manuel.montezelo at gmail.com>



More information about the Aptitude-devel mailing list