From nobody@FreeBSD.org  Fri Jun 20 15:42:20 2008
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 ED6A7106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 20 Jun 2008 15:42:19 +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 BAAAA8FC2A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 20 Jun 2008 15:42:19 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m5KFgIvA004385
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 20 Jun 2008 15:42:18 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m5KFgIt3004382;
	Fri, 20 Jun 2008 15:42:18 GMT
	(envelope-from nobody)
Message-Id: <200806201542.m5KFgIt3004382@www.freebsd.org>
Date: Fri, 20 Jun 2008 15:42:18 GMT
From: Dennis Herrmann <adox@mcx2.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Cronline fix in vnstat 
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         124789
>Category:       ports
>Synopsis:       Cronline fix in net/vnstat
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 20 15:50:01 UTC 2008
>Closed-Date:    Sat Jun 21 00:57:12 UTC 2008
>Last-Modified:  Sat Jun 21 01:00:13 UTC 2008
>Originator:     Dennis Herrmann
>Release:        FreeBSD 7.0-RELEASE
>Organization:
>Environment:
FreeBSD contempt 7.0-RELEASE FreeBSD 7.0-RELEASE #4: Mon Mar 24 11:53:38 CET 2008     root@contempt:/usr/obj/usr/src/sys/MCX  i386

>Description:
Dan Pelleg found a bug in the cron line alias vnstat-cron ,he writed me an email and send me a patch file i checked it and fix few things. Accessorily i add two more Mirrors.

The crontab entry is run as "root". So the test may fail, because the
number of files is greater than one.

Here an example by Dan:

mail2# whoami
root
mail2# ls -l /variable/db/vnstat/
total 20
-rw-r--r--  1 root  wheel  2272 Apr 24 17:50 .sk0
-rw-r--r--  1 root  wheel  2272 Jun 15 11:25 .tun0
-rw-r--r--  1 root  wheel  2272 Apr 24 17:50 .xl0
-rw-r--r--  1 root  wheel  2272 Apr 24 17:50 .xl1
-rw-r--r--  1 root  wheel  2272 Jun 15 11:30 tun0
mail2# su ftp1 -c "ls -l /variable/db/vnstat"
total 4
-rw-r--r--  1 root  wheel  2272 Jun 15 11:30 tun0

Therefore you need to inhibit the listing of the dot-files. This is done
with the "-I" switch.

Dan Pelleg writed Teemu Toivola,the developer of vnstat, a mail .Teemu ratify the bug

"I did some testing with both FreeBSD and Linux. You are correct that
the cron line in its current form doesn't seem behave in all situations
as the user might expect. In the normal "after install" situation when
that directory doesn't contain any files, that cron entry will work
correctly since "ls dbdir" will return 0. It also works correctly when
there's at least one database to work with.

However, now (after I added the database backup feature) the problem
seems to be that since database backups are named according to the
interface name starting with a dot, it might not be clear enough for
the user that both the database file AND the backup file needs to be
removed if the aim is to disable monitoring of the last monitored
interface. Leaving those backups will make the cron line fail in its
current form if the directory looks something like this:

mail2# ls -l /variable/db/vnstat/
total 20
-rw-r--r--  1 root  wheel  2272 Apr 24 17:50 .sk0
-rw-r--r--  1 root  wheel  2272 Jun 15 11:25 .tun0
-rw-r--r--  1 root  wheel  2272 Apr 24 17:50 .xl0
-rw-r--r--  1 root  wheel  2272 Apr 24 17:50 .xl1

So yes, that cron line should now also include that -I and the
documentation for disabling the monitoring of interfaces updated.
However, it seems that the need of -I is only *BSD specific since I
can't reproduce that behaviour on Linux and the -I option has a
difference function (in Linux):

 -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN

Without a pattern, ls either gives an error or the file listing of the
current directory depending of which shell is used." by Teemu Toivola
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- Makefile.org        2008-02-24 12:03:55.000000000 +0100
+++ Makefile	2008-06-20 17:06:54.000000000 +0200
@@ -10,7 +10,9 @@
 PORTREVISION=	2
 CATEGORIES=	net
 MASTER_SITES=	http://humdi.net/vnstat/ \
-		http://mcx2.org/files/
+		http://mirror.mcx2.org/ \
+                http://ftp.uwsg.indiana.edu/FreeBSD/distfiles/ \
+                ftp://ftp.jpix.ad.jp/pub/FreeBSD/ports/distfiles/
 DISTNAME=	${PORTNAME}-${PORTVERSION}_bsd
 
 MAINTAINER=	adox@mcx2.org
@@ -25,7 +27,7 @@
 post-extract:
 	@cd ${WRKSRC} && ${CP} cron/vnstat vnstat-cron
 	@${REINPLACE_CMD} -e 's|/usr/bin|/usr/local/bin|g' \
-		-e 's|/var/lib|/var/db|g' ${WRKSRC}/vnstat-cron
+		-e 's|ls /var/lib|ls -l /var/db|g' ${WRKSRC}/vnstat-cron
 
 post-install:
 .if !defined(NOPORTDOCS)


>Release-Note:
>Audit-Trail:
Class-Changed-From-To: sw-bug->maintainer-update 
Class-Changed-By: linimon 
Class-Changed-When: Fri Jun 20 22:25:43 UTC 2008 
Class-Changed-Why:  
Change class. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=124789 
State-Changed-From-To: open->closed 
State-Changed-By: miwi 
State-Changed-When: Sat Jun 21 00:57:11 UTC 2008 
State-Changed-Why:  
Committed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/124789: commit references a PR
Date: Sat, 21 Jun 2008 00:57:06 +0000 (UTC)

 miwi        2008-06-21 00:57:01 UTC
 
   FreeBSD ports repository
 
   Modified files:
     net/vnstat           Makefile 
   Log:
   - Fix cron handling
   - Add backup mirrors
   - Bump PORTREVISION
   
   PR:             124789
   Submitted by:   Dennis Herrmann <adox@mcx2.org> (maintainer)
   
   Revision  Changes    Path
   1.4       +5 -3      ports/net/vnstat/Makefile
 _______________________________________________
 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"
 
>Unformatted:
