Am 21.04.22 um 18:37 schrieb Ansgar:
Hi,

On Thu, 2022-04-21 at 18:13 +0200, Michael Biebl wrote:

So /usr/bin/systemctl is provided by the "systemctl" package?
Can you post the output of apt-cache policy systemctl

I think the bug reporter suggest to replace the

   system(...) == 0 or error("systemctl preset failed on $scriptname: $!");

with a more correct (and verbose)

   system(...);
   if ($? == -1) {
     error("systemctl preset failed on $scriptname: $!");
   }
   elsif ($? & 127) {
     error("systemctl preset died with signal " . ($? & 127));
   }
   else {
     error("systemctl preset failed with return status " . ($? >> 8));
   }

as `perldoc -f system` suggest. (Untested, so might contain typos and
the like.)

Currently it always give "$!" as the reason, even when not correct.
This would also be incorrect if the real systemctl is used if the
command fails because of syntax errors or so.

Thanks for the additional information, Ansgar.

I guess we have two issues then:
- systemctl (from docker-systemctl-replacement) most likely not being compatible with the real systemctl
- handling of the return code from system()

We do have quite a few calls to system() in our perl code.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to