From moonshade@pnhz.kz  Mon Dec 11 10:45:23 2006
Return-Path: <moonshade@pnhz.kz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id CF71616A4FE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Dec 2006 10:45:23 +0000 (UTC)
	(envelope-from moonshade@pnhz.kz)
Received: from relay.pnhz.kz (relay.pnhz.kz [212.154.198.217])
	by mx1.FreeBSD.org (Postfix) with ESMTP id EBECE43CEC
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Dec 2006 10:43:41 +0000 (GMT)
	(envelope-from moonshade@pnhz.kz)
Received: from abyss.pnhz.kz (abyss.pnhz.kz [192.168.121.40])
	by relay.pnhz.kz with ESMTP id kBBAinBq055807
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Dec 2006 16:44:50 +0600 (ALMT)
	(envelope-from moonshade@pnhz.kz)
Message-Id: <1165833888.76153@abyss.pnhz.kz>
Date: Mon, 11 Dec 2006 16:44:48 +0600
From: "Denis Eremenko <moonshade@pnhz.kz>" <moonshade@pnhz.kz>
To: "FreeBSD gnats submit" <FreeBSD-gnats-submit@freebsd.org>
Subject: mail/milter-regex always do syslog(LOG_DEBUG, ...)
X-Send-Pr-Version: gtk-send-pr 0.4.7 
X-GNATS-Notify:

>Number:         106602
>Category:       ports
>Synopsis:       mail/milter-regex always do syslog(LOG_DEBUG, ...)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dinoex
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 11 10:50:03 GMT 2006
>Closed-Date:    Sat Feb 17 10:10:34 CET 2007
>Last-Modified:  Wed Feb 21 05:00:14 GMT 2007
>Originator:     Denis Eremenko <moonshade@pnhz.kz>
>Release:        FreeBSD 6.2-PRERELEASE i386
>Organization:
>Environment:


System: FreeBSD 6.2-PRERELEASE #0: Tue Dec  5 14:17:41 ALMT 2006
    root@abyss.pnhz.kz:/usr/obj/data/os/FreeBSD/src/6/src/sys/ABYSS-6



>Description:


mail/milter-regex always do syslog(LOG_DEBUG, ...) spamming /var/log/debug.log with each message passing through.
It should be optional.


>How-To-Repeat:


just use it


>Fix:


--- patch-no-log_debug begins here ---
--- milter-regex.c.orig	Mon Dec 11 15:42:26 2006
+++ milter-regex.c	Mon Dec 11 15:52:23 2006
@@ -57,6 +57,7 @@
 
 static const char	*rule_file_name = "/etc/milter-regex.conf";
 static int		 debug = 0;
+static int		 verbose = 0;
 
 struct context {
 	struct ruleset	*rs;
@@ -520,6 +521,9 @@
 	va_list ap;
 	char msg[8192];
 
+	if (!verbose)
+		return;
+
 	va_start(ap, fmt);
 	if (context != NULL)
 		snprintf(msg, sizeof(msg), "%s: ", context->host_addr);
@@ -563,13 +567,16 @@
 	tzset();
 	openlog("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON);
 
-	while ((ch = getopt(argc, argv, "c:dp:u:")) != -1) {
+	while ((ch = getopt(argc, argv, "c:dvp:u:")) != -1) {
 		switch (ch) {
 		case 'c':
 			rule_file_name = optarg;
 			break;
 		case 'd':
-			debug = 1;
+			debug = verbose = 1;
+			break;
+		case 'v':
+			verbose = 1;
 			break;
 		case 'p':
 			oconn = optarg;

--- milter-regex.8.orig	Sat Mar 13 23:21:23 2004
+++ milter-regex.8	Mon Dec 11 15:58:25 2006
@@ -51,7 +51,9 @@
 .Bl -tag -width "-c config"
 .It Fl d
 Don't detach from controlling terminal and produce verbose debug
-output on stdout.
+output on stdout. Implies -v.
+.It Fl v
+Do verbose LOG_DEBUG level logging.
 .It Fl c Ar config
 Use the specified configuration file instead of the default,
 /etc/milter-regex.conf.
--- patch-no-log_debug ends here ---



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->dinoex 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Dec 11 10:50:40 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=106602 

From: =?koi8-r?Q?=E4=C5=CE=C9=D3_?= =?koi8-r?Q?=F7=CC=C1=C4=C9=CD=C9=D2=CF=D7=C9=DE?= =?koi8-r?Q?_?= =?koi8-r?Q?=E5=D2=C5=CD=C5=CE=CB=CF?= <moonshade@pnhz.kz>
To: bug-followup@FreeBSD.org, moonshade@pnhz.kz
Cc:  
Subject: Re: ports/106602: mail/milter-regex always do syslog(LOG_DEBUG,
	...)
Date: Tue, 12 Dec 2006 09:10:25 +0600

 I have disabled _all_ logging w/o -v switch. Pardon.
 Next one should be better - check, please:
 
 --- milter-regex.c.orig	Mon Dec 11 15:42:26 2006
 +++ milter-regex.c	Mon Dec 11 15:52:23 2006
 @@ -57,6 +57,7 @@
  
  static const char	*rule_file_name = "/etc/milter-regex.conf";
  static int		 debug = 0;
 +static int		 verbose = 0;
  
  struct context {
  	struct ruleset	*rs;
 @@ -520,6 +521,9 @@
  	va_list ap;
  	char msg[8192];
  
 +	if (LOG_PRI(priority) > LOG_INFO && !verbose)
 +		return;
 +
  	va_start(ap, fmt);
  	if (context != NULL)
  		snprintf(msg, sizeof(msg), "%s: ", context->host_addr);
 @@ -563,13 +567,16 @@
  	tzset();
  	openlog("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON);
  
 -	while ((ch = getopt(argc, argv, "c:dp:u:")) != -1) {
 +	while ((ch = getopt(argc, argv, "c:dvp:u:")) != -1) {
  		switch (ch) {
  		case 'c':
  			rule_file_name = optarg;
  			break;
  		case 'd':
 -			debug = 1;
 +			debug = verbose = 1;
 +			break;
 +		case 'v':
 +			verbose = 1;
  			break;
  		case 'p':
  			oconn = optarg;
 
 --- milter-regex.8.orig	Sat Mar 13 23:21:23 2004
 +++ milter-regex.8	Mon Dec 11 15:58:25 2006
 @@ -51,7 +51,9 @@
  .Bl -tag -width "-c config"
  .It Fl d
  Don't detach from controlling terminal and produce verbose debug
 -output on stdout.
 +output on stdout. Implies -v.
 +.It Fl v
 +Do verbose LOG_DEBUG level logging.
  .It Fl c Ar config
  Use the specified configuration file instead of the default,
  /etc/milter-regex.conf.
 
 
State-Changed-From-To: open->feedback 
State-Changed-By: dinoex 
State-Changed-When: Fri Dec 15 21:46:10 CET 2006 
State-Changed-Why:  


I contacted Daniel Hartmeier the author of this software. 

He wrote: 

> I kind of like having debug messages sent to syslog by default, even 
> though they should be dropped there in most cases. That way, you can 
> temporarily get debug messages from the running process by toggling 
> syslog.conf, and don't have to restart the process. 
>  
> Some bugs only occur after days of process lifetime, and telling the 
> user to restart the process with debug logging enabled means that it 
> will take several days longer to reach the next occurance of the bug, as 
> well has having to store debug messages over that entire period. 

a) 
I suggest to add some entries in your syslogd.conf. 

b) 
you rewwork the patch to keep the default behaivior 

c) 
you rework your patch, so it will be an option to this port. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=106602 

From: Denis Eremenko <moonshade@pnhz.kz>
To: bug-followup@FreeBSD.org, moonshade@pnhz.kz
Cc:  
Subject: Re: ports/106602: mail/milter-regex always do syslog(LOG_DEBUG,
	...)
Date: Tue, 26 Dec 2006 08:49:48 +0600

 I did it in b) way.
 
 PS: I understand that author may love debug logging, but is this most
 expected way for application? Does it violates POLA? I, personally, was
 quite "astonished" when found my /var was eaten by /var/log/debug.log
 
 --- milter-regex.8.orig	Thu Dec 21 17:15:05 2006
 +++ milter-regex.8	Thu Dec 21 17:22:46 2006
 @@ -52,6 +52,8 @@
  .It Fl d
  Don't detach from controlling terminal and produce verbose debug
  output on stdout.
 +.It Fl q
 +Don't send to syslog messages with priority higher than LOG_NOTICE.
  .It Fl c Ar config
  Use the specified configuration file instead of the default,
  /etc/milter-regex.conf.
 --- milter-regex.c.orig	Thu Dec 21 17:13:26 2006
 +++ milter-regex.c	Thu Dec 21 17:23:28 2006
 @@ -57,6 +57,7 @@
  
  static const char	*rule_file_name = "/etc/milter-regex.conf";
  static int		 debug = 0;
 +static int		 quiet = 0;
  
  struct context {
  	struct ruleset	*rs;
 @@ -520,6 +521,9 @@
  	va_list ap;
  	char msg[8192];
  
 +	if (LOG_PRI(priority) > LOG_INFO && quiet)
 +		return;
 +
  	va_start(ap, fmt);
  	if (context != NULL)
  		snprintf(msg, sizeof(msg), "%s: ", context->host_addr);
 @@ -563,13 +567,16 @@
  	tzset();
  	openlog("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON);
  
 -	while ((ch = getopt(argc, argv, "c:dp:u:")) != -1) {
 +	while ((ch = getopt(argc, argv, "c:dqp:u:")) != -1) {
  		switch (ch) {
  		case 'c':
  			rule_file_name = optarg;
  			break;
  		case 'd':
  			debug = 1;
 +			break;
 +		case 'q':
 +			quiet = 1;
  			break;
  		case 'p':
  			oconn = optarg;
 
 

From: Denis Eremenko <moonshade@pnhz.kz>
To: bug-followup@FreeBSD.org, moonshade@pnhz.kz
Cc:  
Subject: Re: ports/106602: mail/milter-regex always do syslog(LOG_DEBUG,
	...)
Date: Mon, 05 Feb 2007 11:57:26 +0600

 Author still rejects? Even when patch doesn't change default behavior?
 
 
State-Changed-From-To: feedback->closed 
State-Changed-By: dinoex 
State-Changed-When: Sat Feb 17 10:10:10 CET 2007 
State-Changed-Why:  
committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=106602 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/106602: commit references a PR
Date: Sat, 17 Feb 2007 09:09:48 +0000 (UTC)

 dinoex      2007-02-17 09:09:43 UTC
 
   FreeBSD ports repository
 
   Modified files:
     mail/milter-regex    Makefile 
   Added files:
     mail/milter-regex/files patch-quiet 
   Log:
   - add flag -quiet
   PR:             106602
   Submitted by:   Denis Eremenko
   
   Revision  Changes    Path
   1.18      +1 -0      ports/mail/milter-regex/Makefile
   1.1       +51 -0     ports/mail/milter-regex/files/patch-quiet (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: Mike Brown <mike@skew.org>
To: bug-followup@freebsd.org
Cc: moonshade@pnhz.kz, dinoex@freebsd.org
Subject: Re: ports/106602: mail/milter-regex always do
 syslog(LOG_DEBUG, ...)
Date: Fri, 16 Feb 2007 17:49:35 -0700 (MST)

 Pardon me for intruding, but I agree with the author.
 Any software can send whatever it wants to syslog.
 Nothing wrong with that. Syslog is configurable.
 
 Option B is the correct solution. Modify /etc/syslog.conf
 (or advise the user to do so, post-install), with something
 like this:
 
 !milter-regex
 daemon.debug	/dev/null
 daemon.!=debug	/var/log/maillog
 
 
 I prefer to save the debug messages in another file,
 so I use /etc/newsyslog.conf to manage its rotation.
 That also allows you to put a cap on its size.

From: Denis Eremenko <moonshade@pnhz.kz>
To: bug-followup@FreeBSD.org, moonshade@pnhz.kz
Cc:  
Subject: Re: ports/106602: mail/milter-regex always do syslog(LOG_DEBUG,
	...)
Date: Wed, 21 Feb 2007 10:51:00 +0600

 > Modify /etc/syslog.conf
 > (or advise the user to do so, post-install), with something
 > like this:
 
 > !milter-regex
 > daemon.debug /dev/null
 > daemon.!=debug /var/log/maillog
 
 In this case many unnecessary syslog() calls and data transfers still
 exists. Overhead.
 
 
>Unformatted:
