Bug 124789 - Cronline fix in net/vnstat
Summary: Cronline fix in net/vnstat
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs mailing list
Depends on:
Reported: 2008-06-20 16:50 UTC by Dennis Herrmann
Modified: 2008-06-21 02:00 UTC (History)
0 users

See Also:

file.diff (752 bytes, patch)
2008-06-20 16:50 UTC, Dennis Herrmann
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Herrmann 2008-06-20 16:50:01 UTC
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
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

Fix: Patch attached with submission follows:
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2008-06-20 23:25:43 UTC
Class Changed
From-To: sw-bug->maintainer-update

Change class.
Comment 2 dfilter service freebsd_committer 2008-06-21 01:57:06 UTC
miwi        2008-06-21 00:57:01 UTC

  FreeBSD ports repository

  Modified files:
    net/vnstat           Makefile 
  - Fix cron handling
  - Add backup mirrors
  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
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Martin Wilke freebsd_committer 2008-06-21 01:57:11 UTC
State Changed
From-To: open->closed

Committed. Thanks!