[SOLVED] Maybe bug in xrctl's handling of uselogger / logger

Found a bug? Make a post in this forum.

[SOLVED] Maybe bug in xrctl's handling of uselogger / logger

Postby thehobbit » Tue Oct 13, 2009 12:38 am

Unless I'm missing something, I don't believe it's possible to get the "xr-${service}" tag into logger at all:

Code: Select all
my $logger = find_bin($default_logger);
if (istrue($sysconf{uselogger}) and defined($logger)) {
   if ($logger eq 'logger') {
      return ("|$logger -t 'xr-$service'");
   } else {
      return ("|$logger");
   }


It looks like find_bin() either returns undef, or a full path to a $default_logger (in my case, /usr/bin/logger), so the comparison against 'logger' is always false. Perhaps this should be changed to check $default_logger instead of $logger, and to allow substitution in arbitrary $logger commands of the string "{service}"?
Code: Select all
--- xrctl.a     2009-10-12 15:27:49.000000000 -0700
+++ xrctl.b     2009-10-12 15:35:31.000000000 -0700
@@ -398,9 +398,10 @@
     my $service = shift;
     my $logger = find_bin($default_logger);
     if (istrue($sysconf{uselogger}) and defined($logger)) {
-       if ($logger eq 'logger') {
+       if ($default_logger eq 'logger') {
            return ("|$logger -t 'xr-$service'");
        } else {
+           $logger =~ s/\{service\}/$service/g;
            return ("|$logger");
        }
     } else {
thehobbit
 
Posts: 9
Joined: Wed Oct 08, 2008 2:04 am
Location: California

Postby Karel » Wed Oct 14, 2009 1:25 pm

Hi Hobbit,

you're sooo right - your fix is literally in the new version, see also http://xrforum.org/viewtopic.php?t=498.
Thanks for reporting this and figuring it all out!

/Karel
Karel
Site Admin
 
Posts: 308
Joined: Mon Sep 22, 2008 11:13 am
Location: Netherlands

Postby thehobbit » Wed Oct 14, 2009 11:06 pm

Karel wrote:Hi Hobbit,

you're sooo right - your fix is literally in the new version, see also http://xrforum.org/viewtopic.php?t=498.
Thanks for reporting this and figuring it all out!

/Karel


Thank you for getting it fixed so quickly.
thehobbit
 
Posts: 9
Joined: Wed Oct 08, 2008 2:04 am
Location: California


Return to Crossroads Bugs

Who is online

Users browsing this forum: No registered users and 0 guests

cron