Public bug reported:

In this code:

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

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

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

$Debconf::Db::config=Debconf::Db->makedriver(
    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");
    exit(1);
}
```

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

** Affects: installation-report (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1848819

Title:
  gen-preseed always errors

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/installation-report/+bug/1848819/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to