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::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.


** Changed in: logwatch (Ubuntu Bionic)
       Status: Fix Released => In Progress

** Changed in: logwatch (Ubuntu Focal)
       Status: Fix Released => In Progress

** Changed in: logwatch (Ubuntu Groovy)
       Status: Fix Released => In Progress

** Changed in: logwatch (Ubuntu)
       Status: Fix Released => In Progress

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

Title:
  Logwatch package points to wrong location for zfs utils

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/logwatch/+bug/1880211/+subscriptions

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

Reply via email to