conf/93472: [patch] /etc/periodic/daily/440.status-mailq exits with bad value when daily_status_mailq_shorten is set to YES

Petr Rehor prehor at gmail.com
Fri Feb 17 03:10:11 PST 2006


>Number:         93472
>Category:       conf
>Synopsis:       [patch] /etc/periodic/daily/440.status-mailq exits with bad value when daily_status_mailq_shorten is set to YES
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 17 11:10:10 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Petr Rehor
>Release:        FreeBSD 6.0-RELEASE-c3 i386
>Organization:
>Environment:
System: FreeBSD charon.rx.cz 6.0-RELEASE-c3 FreeBSD 6.0-RELEASE-c3 #0: Tue Nov 8 20:44:39 UTC 2005 root at marvin.rx.cz:/usr/obj/usr/src/sys/GENERIC i386
>Description:
/etc/periodic/daily/440.status-mailq exits wits 0 when
daily_status_mailq_shorten is set to YES and you have two
mails with same recipient in mail queue.
>How-To-Repeat:
Put exactly two mails with same recipient to mail queue, set

	daily_status_mailq_shorten="YES"

in your /etc/periodic.conf and run

	/etc/periodic/daily/440.status-mailq; echo $?

It prints one about items in mail queue line to terminal but exits with 0.
>Fix:

--- 440.status-mailq.diff begins here ---
Index: 440.status-mailq
===================================================================
RCS file: /home/ncvs/src/etc/periodic/daily/440.status-mailq,v
retrieving revision 1.10
diff -u -r1.10 440.status-mailq
--- 440.status-mailq	7 Feb 2006 08:21:06 -0000	1.10
+++ 440.status-mailq	17 Feb 2006 10:54:13 -0000
@@ -32,8 +32,9 @@
 			awk '$1 > 1 {print $1, $2}';;
 		*)
 		    mailq;;
-	    esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)
-	    [ $rc -gt 1 ] && rc=1 || rc=0
+	    esac | tee /dev/stderr |
+	    egrep -v '(mqueue is empty|Total requests)' | wc -l)
+	    [ $rc -gt 0 ] && rc=1 || rc=0
 
 	    case "$daily_status_include_submit_mailq" in
 	    [Yy][Ee][Ss])
@@ -52,8 +53,9 @@
 				awk '$1 > 1 {print $1, $2}';;
 			*)
 			    mailq -Ac;;
-		    esac | tee /dev/stderr | fgrep -v 'mqueue is empty' | wc -l)
-		    [ $rc_submit -gt 1 ] && rc=1
+		    esac | tee /dev/stderr |
+		    egrep -v '(mqueue is empty|Total requests)' | wc -l)
+		    [ $rc_submit -gt 0 ] && rc=1
 		fi;;
 	    esac
 	fi;;
--- 440.status-mailq.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list