← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1880211] Re: Logwatch package points to wrong location for zfs utils

 

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 नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1880211

Title:
  Logwatch package points to wrong location for zfs utils

Status in logwatch package in Ubuntu:
  In Progress
Status in logwatch source package in Xenial:
  In Progress
Status in logwatch source package in Bionic:
  In Progress
Status in logwatch source package in Focal:
  In Progress
Status in logwatch source package in Groovy:
  In Progress

Bug description:
  [Impact]
  Logwatch fails to print info for ZFS due to invalid paths to binaries.

  [Test Case]
  With ZFS installed, run logwatch and note the missing ZFS information.

  $ sudo apt-get install zfsutils-linux
  $ sudo logwatch --detail Low --range all --service zz-zfs --output stdout

  In the bugged version, this produces no output.

  With a successful configuration, you will see something such as:

   --------------------- ZFS Report Begin ------------------------

   /dev/zfs and /proc/self/mounts are required.
   Try running 'udevadm trigger' and 'mount -t proc proc /proc' as root.
   
   ---------------------- ZFS Report End ------------------------- 

  [Regression Potential]
  Since logwatch filters logs for errors pertinent to administrators,
  standard things to watch out for are undesired changes in this filtering
  behavior, such as flagging or failing to flag issues differently than
  before, other than the specific messages being filtered with this
  change.

  [Discussion]
  In /usr/share/logwatch/scripts/services/zz-zfs line 54 and 55 are the following.
  my $pathto_zpool = $ENV{'pathto_zpool'} || '/usr/sbin/zpool';
  my $pathto_zfs   = $ENV{'pathto_zfs'}   || '/usr/sbin/zfs';

  In Ubuntu, the zfs utilities are in /sbin, not /usr/sbin. This causes
  logwatch to not print info for ZFS even if you're using it.

  The fix is just to point to /sbin instead. This is what fixed it for
  me.

  my $pathto_zpool = $ENV{'pathto_zpool'} || '/sbin/zpool';
  my $pathto_zfs   = $ENV{'pathto_zfs'}   || '/sbin/zfs';

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