From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Jun 20 15:50:03 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 011D31065682 for ; Fri, 20 Jun 2008 15:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B302D8FC20 for ; Fri, 20 Jun 2008 15:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m5KFo2S3081088 for ; Fri, 20 Jun 2008 15:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m5KFo2Ec081087; Fri, 20 Jun 2008 15:50:02 GMT (envelope-from gnats) Resent-Date: Fri, 20 Jun 2008 15:50:02 GMT Resent-Message-Id: <200806201550.m5KFo2Ec081087@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dennis Herrmann Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED6A7106566C for ; 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 ; 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 ; 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 To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/124789: Cronline fix in vnstat X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2008 15:50:03 -0000 >Number: 124789 >Category: ports >Synopsis: Cronline fix in vnstat >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jun 20 15:50:01 UTC 2008 >Closed-Date: >Last-Modified: >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: >Unformatted: