dpkg-reconfigure does not process manually activated triggers

Bug #1594457 reported by Sasa Vilic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
debconf (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have package A that activated trigger and package B which should be reconfigured when trigger is activated (listens for trigger). Trigger is activated by postinst script in package A by using `dpkg-trigger my-trigger`.

After looking into source code (/usr/sbin/dpkg-reconfigure), I can see that problem is in method triggers_pending from line 201-206. What happens is that variable $triggers will contain additional space at the end of line (not present in 16.04) and so it will satisfy condition on line 205.

So what happens is following?
1. When dpkg-reconfigure is executed, triggers_pending is called to get information about packages with pending triggers
2. Because of bug, every package will be put into list (packages without pending triggers)
3. At the end, dpkg-reconfigure will call again triggers_pending() and will check of new packages that have pending triggers. But because all packages are on original list, no change is detected and none of pending packages is (re-)configured. This leave original package in trigger-pending state.

How to reproduce?
1. Create package A, and it's postinst script call 'dpkg-trigger A-my-trigger'
2. Create package B, that listens for 'A-my-trigger'
3. Install both packages
4. Do: dpkg-reconfigure A
5. Package A will be left broken and no reconfigure step will be executed for package B

How to fix?

Well, I replaced /usr/sbin/dpkg-reconfigure: if (length $triggers) {
with: if ($triggers !~ /^\s*$/) {

and this solved the problem, except that it introduced additional problem:

My package A does not use debconf for querying parameters and package B does. But because dpkg-reconfigure messes with DEBIAN_HAS_FRONTEND environment variable, the frontend is not started, but instead db_get questions are posted on console (to user) and reconfiguration is halted. Currently, I don't know enough debconf system in order to provide solution for this.

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.