Bug#442287: dpkg-reconfigure segfaults : cause found
Hi,
After some investigation, I finally found what was happening in this
bug. It follows this sequence :
- template_db_new(), question_db_new(). At this point, both dbs are
empty.
- frontend_new() creates a new frontend as g_frontend, based on the
--frontend parameter or config file. It tries to set debconf/frontend,
which doesn't exist yet.
- g_config->methods.load() loads the database, including
debconf/frontend.
- first call to go() (int commands.c), reading debconf/frontend, which
is different from the current one. Therefore it shuts it down, and frees
it (it is the one g_frontend points to, remember).
- Things go on, until the call to cleanup(), which tries to shutdown,
and free, g_frontend, for the second time. Hence the segfault. This
would also happen when dpkg-reconfigure-ing several packages.
This points to several issues :
- The templates and questions dbs should be loaded *before* the call to
frontend_new(). It would avoid the unexpected change of frontend. The
patch is trivial for that.
- The change of frontend while running is not handled gracefully. I
believe the safest solution would be to update g_frontend with
confmodule->frontend in runconfmodule().
I have a patch ready for all this, and will push things in git by
tomorrow hopefully.
Regis
Reply to: