Bug#339030: svlogd appends extra newline to lines logged to file if also logging to udp

2005-11-30 Thread Gerrit Pape
tags 339030 + patch pending
quit

On Mon, Nov 14, 2005 at 04:57:12PM +0100, Andras Korn wrote:
 I recently started seeing extra newlines between the messages in my system
 logs (logged via socklog and svlogd). stracing svlogd I see this (sorry
[...]

 As you can see, the line as read from stdin only had one \n at the end; it
 was then transmitted via udp to a log server, still with only one \n at the
 end; and then, it was logged to a file with an extra \n.
 
 The config file for the relevant log directory reads:
 
 --- cut here ---
 s50
 n25
 -*
 +*:*:*:* amavis*
 +*: amavis*
 !/usr/local/sbin/multilogcheck amavis
 uIP.OF.LOG.SERVER
 --- cut here ---
 
 If I remove the last line (uIP.OF.LOG.SERVER), the extra newline is no
 longer appended.

Yes, I can reproduce this, thanks for the good report.  Here's a patch
that should fix it; I'll include it into the next package upload.

Thanks, Gerrit.
Index: src/svlogd.c
===
RCS file: /cvs/runit/src/svlogd.c,v
retrieving revision 1.16
diff -u -r1.16 svlogd.c
--- src/svlogd.c11 Jul 2005 11:53:46 -  1.16
+++ src/svlogd.c30 Nov 2005 10:49:09 -
@@ -784,9 +784,9 @@
sizeof(dir[i].udpaddr)) != linelen) {
   buffer_puts(dir[i].b, warning: failure sending through udp: );
   buffer_put(dir[i].b, line, linelen);
-  buffer_put(dir[i].b, \n, 1);
   buffer_flush(dir[i].b);
 }
+   if (line[linelen -1] == '\n') --linelen;
   }
 }
 if (! dir[i].udponly) {


Bug#339030: svlogd appends extra newline to lines logged to file if also logging to udp

2005-11-14 Thread Andras Korn
Package: runit
Version: 1.3.1-1
Severity: normal

Hi,

I recently started seeing extra newlines between the messages in my system
logs (logged via socklog and svlogd). stracing svlogd I see this (sorry
about the long lines):

read(0, mail.info: Nov 14 16:40:21 amavis[2679]: (02679-12) Passed, [EMAIL 
PROTECTED] - [EMAIL PROTECTED], Message-ID: [EMAIL PROTECTED], Hits: 
-2.592\n, 1024) = 207
gettimeofday({1131982821, 161063}, NULL) = 0
sendto(6, mail.info: Nov 14 16:40:21 amavis[2679]: (02679-12) Passed, [EMAIL 
PROTECTED] - [EMAIL PROTECTED], Message-ID: [EMAIL PROTECTED], Hits: 
-2.592\n, 207, 0, {sa_family=AF_UNSPEC, 
sa_data=\2\2\230BS\205\0\0\0\0\0\0\0\0}, 16) = 207
write(7, @40004378afef0999a24c mail.info: Nov 14 16:40:21 amavis[2679]: 
(02679-12) Passed, [EMAIL PROTECTED] - [EMAIL PROTECTED], Message-ID: 
[EMAIL PROTECTED], Hits: -2.592\n\n, 234) = 234

As you can see, the line as read from stdin only had one \n at the end; it
was then transmitted via udp to a log server, still with only one \n at the
end; and then, it was logged to a file with an extra \n.

The config file for the relevant log directory reads:

--- cut here ---
s50
n25
-*
+*:*:*:* amavis*
+*: amavis*
!/usr/local/sbin/multilogcheck amavis
uIP.OF.LOG.SERVER
--- cut here ---

If I remove the last line (uIP.OF.LOG.SERVER), the extra newline is no
longer appended.

Andras

-- System Information:
Debian Release: unstable
  APT prefers breezy-security
  APT policy: (500, 'breezy-security'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11.7-chardonnay-skas3-v8-rc2
Locale: LANG=C, LC_CTYPE=hu_HU (charmap=ISO-8859-2)

-- no debconf information

-- 
 Andras Korn korn at chardonnay.math.bme.hu
 http://chardonnay.math.bme.hu/~korn/ QOTD:
   A faba szorult favago esete Toth Marival.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]