gen-preseed always errors

Bug #1848819 reported by Dennis Williamson on 2019-10-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
installation-report (Ubuntu)

Bug Description

In this code:

# A bit of a hack..
my $di_path;
if (-d "/var/log/installer") {
} else {

if (! -f "$di_path") {
    print("Unable to find debconf database: $di_path\n");

Debconf::Db->load(readonly => "true");

    driver => "File",
    name => "di_questions",
    filename => "$di_path/questions.dat",
    readonly => "true",

If `cdebconf` is a directory, the second `if` is true and the script exits with "Unable to find debconf database". Yet the `makedriver` instance(s) require `$di_path` to be set to a directory name (which contains files such as `questions.dat`.

If `cdebconf` is a file then the `! -f` test passes and `makedriver` tries to use a filename as a directory name and errors with a "could not open" message.

If `cdebconf` doesn't exist, then the `-! -f` test does the right thing.

In each of those cases, the script is exited and the remainder never runs.

To fix this issue, the test should be changed from `! -f` to `! -d`:

if (! -d "$di_path") {
    print("Unable to find debconf database: $di_path\n");

As seen in Bionic and other releases.
```$ apt-cache policy installation-report
  Installed: 2.62ubuntu1

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

Other bug subscribers