pve7to8: fix broken pipe warning for dkms status invocation

The check for dkms kernel modules relies on the output of `dkms
status`. dkms command invocation will perform the following sanity
check:
```
if [ ! -e <(echo) ]; then
    warn $"dkms will not function properly if /proc is not mounted."
fi
```

This check will however throw the following warning when SIGPIPE is
set to be ignored:

```
sbin/dkms: line 2497: echo: write error: Broken pipe
```

While only cosmetic, this can be confusing. Therefore, temporarily
enable SIGPIPE before calling dkms, restoring the originally setting
afterwards.

Reported-by: Alexander Zeidler <a.zeidler@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2025-03-28 18:48:28 +01:00 committed by Thomas Lamprecht
parent e913f15d3b
commit 2bbf10d9ef

View File

@ -1356,9 +1356,12 @@ sub check_dkms_modules {
$count = scalar @_; $count = scalar @_;
}; };
my $sig_pipe = $SIG{PIPE};
$SIG{PIPE} = "DEFAULT";
my $exit_code = eval { my $exit_code = eval {
run_command(['dkms', 'status', '-k', '`uname -r`'], outfunc => $set_count, noerr => 1) run_command(['dkms', 'status', '-k', '`uname -r`'], outfunc => $set_count, noerr => 1)
}; };
$SIG{PIPE} = $sig_pipe;
if ($exit_code != 0) { if ($exit_code != 0) {
log_skip("could not get dkms status"); log_skip("could not get dkms status");