The intention of upstream's fix appears to want to rely on $PATH for running zpool and zfs, however as mentioned in comment #20, the test after the setting needs a full path:
my $pathto_zpool = $ENV{'pathto_zpool'} || '/usr/sbin/zpool';
...
if (!-x $pathto_zpool) {
# Doesn't support ZFS
exit 0;
}
Perl's '-x' operator works on files/filehandles (c.f. https://perldoc.perl.org/functions/-X), and does not take $PATH into account, as can be seen in this trivial test case:
logwatch-sru-lp1880211-xenial+16.04:~$ perl testcase
abspath ok
relpath nak
For what upstream intends, I suspect the "proper" fix would be to use something like Perl's searchpath() (c.f. https://metacpan.org/pod/File::SearchPath). In Ubuntu searchpath() is provided by the libfile-searchpath-perl binary package which unfortunately is only available from universe. Fortunately, in this case we can make the assumption that the tool will only be in /sbin or /usr/sbin, and just look in those spots rather than the full path formally.
The intention of upstream's fix appears to want to rely on $PATH for running zpool and zfs, however as mentioned in comment #20, the test after the setting needs a full path:
my $pathto_zpool = $ENV{'pathto_ zpool'} || '/usr/sbin/zpool';
...
if (!-x $pathto_zpool) {
# Doesn't support ZFS
exit 0;
}
Perl's '-x' operator works on files/filehandles (c.f. https:/ /perldoc. perl.org/ functions/ -X), and does not take $PATH into account, as can be seen in this trivial test case:
logwatch- sru-lp1880211- xenial+ 16.04:~ $ cat testcase
#!/usr/bin/perl
if (-x '/usr/bin/less') { print "abspath ok\n"; } else { print "abspath nak\n"; }
if (-x 'less') { print "relpath ok\n"; } else { print "relpath nak\n"; }
logwatch- sru-lp1880211- xenial+ 16.04:~ $ perl testcase
abspath ok
relpath nak
For what upstream intends, I suspect the "proper" fix would be to use something like Perl's searchpath() (c.f. https:/ /metacpan. org/pod/ File::SearchPat h). In Ubuntu searchpath() is provided by the libfile- searchpath- perl binary package which unfortunately is only available from universe. Fortunately, in this case we can make the assumption that the tool will only be in /sbin or /usr/sbin, and just look in those spots rather than the full path formally.