[Bug 1848819] [NEW] gen-preseed always errors
Dennis Williamson
1848819 at bugs.launchpad.net
Fri Oct 18 22:57:08 UTC 2019
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
Foundations Bugs, which is subscribed to installation-report in Ubuntu.
https://bugs.launchpad.net/bugs/1848819
Title:
gen-preseed always errors
Status in installation-report package in Ubuntu:
New
Bug description:
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
```
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/installation-report/+bug/1848819/+subscriptions
More information about the foundations-bugs
mailing list