From nobody@FreeBSD.org  Sun Sep  9 20:54:13 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B67A516A417
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  9 Sep 2007 20:54:13 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 83F5E13C442
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  9 Sep 2007 20:54:13 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l89KsD09008052
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 9 Sep 2007 20:54:13 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.1/8.14.1/Submit) id l89KsDNd008051;
	Sun, 9 Sep 2007 20:54:13 GMT
	(envelope-from nobody)
Message-Id: <200709092054.l89KsDNd008051@www.freebsd.org>
Date: Sun, 9 Sep 2007 20:54:13 GMT
From: Olli Hauer <ohauer@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [path] ugly output of the 405.status-ata-raid if fdescfs is mounted
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         116237
>Category:       conf
>Synopsis:       [patch] ugly output of the 405.status-ata-raid if fdescfs is mounted
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 09 21:00:08 GMT 2007
>Closed-Date:    Thu Jul 22 13:02:24 EDT 2010
>Last-Modified:  Thu Jul 22 13:02:24 EDT 2010
>Originator:     Olli Hauer
>Release:        FreeBSD 6.2-RELEASE-p7
>Organization:
>Environment:
FreeBSD 6.2-RELEASE-p7
>Description:
If you use the 405.status-ata-raid option to monitor the status of your
ar raids for example promise ... the outout of the daily mail is nearly
unusable if fdescfs is mounted.

fdescfs is needed for example for the port mail/spamd

The output in the mail looks like this:

find: /dev/fd/3/.k5login: No such file or directory
find: /dev/fd/3/.cshrc: No such file or directory
find: /dev/fd/3/.login: No such file or directory
find: /dev/fd/3/.profile: No such file or directory
find: /dev/fd/3/.bash_profile: No such file or directory
find: /dev/fd/3/.bash_history: No such file or directory
find: /dev/fd/3/cvsup: No such file or directory
find: /dev/fd/3/bin: No such file or directory
find: /dev/fd/3/.ssh: No such file or directory
find: /dev/fd/3/.xinitrc: No such file or directory
find: /dev/fd/3/update_ports.sh: No such file or directory
find: /dev/fd/3/ret_1.sh: No such file or directory
find: /dev/fd/3/.cvsrc: No such file or directory
find: /dev/fd/3/.vnc: No such file or directory
find: /dev/fd/3/X0-config.keyboard: No such file or directory
find: /dev/fd/3/xorg.conf.new: No such file or directory
find: /dev/fd/3/.Xauthority: No such file or directory
find: /dev/fd/3/.fluxbox_old: No such file or directory

>How-To-Repeat:
To have an expirience how the daily staus mail looks do the following.

mount -t fdescfs fdescfs /dev/fd
cd /
find /dev -name 'ar[0-9]'


>Fix:
see attached patches for:
 - etc/default/periodic.conf
 - src/share/man/man5/periodic.conf.5
 - etc/periodic/daily/405.,status-ata-raid

Now You have a extra parameter
 - dayly_status_ata_raid_list=""

for example 
 - ar0 => "0"
 - ar0 and ar1 => "0 1"

the output is now clear and displays the right thing.

Patch attached with submission follows:

--- src/etc/periodic/daily/405.status-ata-raid.orig
+++ src/etc/periodic/daily/405.status-ata-raid
@@ -16,15 +16,29 @@
 	echo
 	echo 'Checking status of ATA raid partitions:'
 
+	eval arlist=\$daily_status_ata_raid_list
+
 	rc=0
-	for raid in `find /dev/ -name 'ar[0-9]*' -type c | egrep '[0-9]$' \
-		| egrep -v 's[0-9]' | cut -d / -f 3`
-	     do
-		status=`/sbin/atacontrol status $raid`
-		echo $status
-		raid_rc=`echo $status | grep -v READY | wc -l`
-		[ $rc -eq 0 ] && [ $raid_rc -gt 0 ] && rc=3
-	     done
+
+	if [ "X$arlist" != "X" ]; 
+	then  
+            for raid in $arlist; 
+            do
+                status=`/sbin/atacontrol status ar$raid`
+                echo $status
+                raid_rc=`echo $status | grep -v READY | wc -l`
+                [ $rc -eq 0 ] && [ $raid_rc -gt 0 ] && rc=3
+            done
+	else
+            for raid in `find /dev/ -name 'ar[0-9]*' -type c | egrep '[0-9]$' \
+             | egrep -v 's[0-9]' | cut -d / -f 3`
+            do 
+                status=`/sbin/atacontrol status $raid`
+                echo $status
+                raid_rc=`echo $status | grep -v READY | wc -l`
+                [ $rc -eq 0 ] && [ $raid_rc -gt 0 ] && rc=3
+            done
+	fi
 	;;
 
     *)  rc=0;;
--- src/etc/defaults/periodic.conf.orig
+++ src/etc/defaults/periodic.conf
@@ -90,6 +90,9 @@
 
 # 405.status-ata_raid
 daily_status_ata_raid_enable="NO"			# Check ATA raid status
+daily_status_ata_raid_list=""				# List of ataraids, if empty raids are searched 
+							# Example for ar0 and ar1
+							# sample: daily_status_ata_raid_list="0 1" 
 
 # 406.status-gmirror
 daily_status_gmirror_enable="NO"			# Check gmirror(8)
--- src/share/man/man5/periodic.conf.5.orig
+++ src/share/man/man5/periodic.conf.5
@@ -359,6 +359,15 @@
 on your
 .Xr ataraid 4
 arrays.
+.It Va daily_status_ata_raid_list
+.Pq Vt num
+Set to
+.Dq "0 1"
+if you want to run
+.Nm atacontrol status
+on your
+.Xr ataraid 4
+ar0 and ar1 arrays. If empty the arrays are searched.
 .It Va daily_status_gmirror_enable
 .Pq Vt bool
 Set to


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: remko 
Responsible-Changed-When: Sun Dec 23 11:17:21 UTC 2007 
Responsible-Changed-Why:  
I think this belongs to the -RC group 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116237 
Responsible-Changed-From-To: freebsd-rc->freebsd-bugs 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Sat Jan 12 23:05:20 UTC 2008 
Responsible-Changed-Why:  

Return this to the pool. Periodic != rc.d. 

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

From: Jilles Tjoelker <jilles@stack.nl>
To: bug-followup@FreeBSD.org, ohauer@gmx.de
Cc:  
Subject: Re: conf/116237: [patch] ugly output of the 405.status-ata-raid if
	fdescfs is mounted
Date: Sat, 6 Jun 2009 10:32:20 +0200

 The ugly output has been fixed in fdescfs in -CURRENT. All fdescfs nodes
 now appear as character devices so find(1) and similar tools do not
 enter open directories.
 
 -- 
 Jilles Tjoelker
State-Changed-From-To: open->closed 
State-Changed-By: glarkin 
State-Changed-When: Thu Jul 22 13:00:48 EDT 2010 
State-Changed-Why:  
Closed by request of submitter (via email) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116237 
>Unformatted:
