Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Sep 2007 20:36:44 GMT
From:      Michael W Lucas <mwlucas@blackhelicopters.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/116677: [patch] flow-tools on amd64 is broken
Message-ID:  <200709262036.l8QKaiIq081564@www.freebsd.org>
Resent-Message-ID: <200709262040.l8QKe2p0022827@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         116677
>Category:       ports
>Synopsis:       [patch] flow-tools on amd64 is broken
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 26 20:40:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Michael W Lucas
>Release:        7.0-current
>Organization:
none
>Environment:
FreeBSD aubsr019.us.add 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Thu Jun 14 15:36:22 EDT 2007     system_mwl@aubsr019.us.add:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:

flow-tools on amd64 platforms is known to be broken.  See
http://mailman.splintered.net/pipermail/flow-tools/2004-December/002501.html
and
http://www.mail-archive.com/flow-tools@list.splintered.net/msg00471.html
-- or, if you prefer, see how many mailing list postings link to these
two postings as the solution.

More discussion of the problem from our own Bill F. at
http://www.mail-archive.com/flow-tools@list.splintered.net/msg00470.html

Maybe "flow-tools on amd64 is broken" is too strong; it does compile, after all.  But the results are not useful...
>How-To-Repeat:

Run flow-cat flowfile-XXXX | flow-print -f 1 on any amd64 platform.
Look at the dates.  They are garbage.

>Fix:

One of the attached files is a new patch.  The other is an updated
version of an existing patch file.


Patch attached with submission follows:

--- lib/ftfile.c.orig	Wed Sep 26 16:21:38 2007
+++ lib/ftfile.c	Wed Sep 26 16:20:49 2007
@@ -311,7 +311,7 @@
 int ftfile_expire (struct ftfile_entries *fte, int doit, int curbytes)
 {
   u_int i;
-  struct ftfile_entry *n1;
+  struct ftfile_entry *n1, *n2;
   u_int64 bytes;
 
   /*
@@ -323,15 +323,20 @@
   bytes = 0;
 
   if (fte->max_files && (fte->num_files > fte->max_files)) {
+    n2 = NULL;
     FT_TAILQ_FOREACH(n1, &fte->head, chain) {
+      if (n2 != NULL) {
+	ftfile_entry_free(n2);
+	n2 = NULL;
+      }
       fterr_info("remove/1 %s", n1->name);
       bytes += n1->size;
       ++i;
       if (doit) {
+        n2 = n1;
         FT_TAILQ_REMOVE(&fte->head, n1, chain);
         if (unlink(n1->name) == -1) 
           fterr_warn("unlink(%s)", n1->name);
-        ftfile_entry_free(n1);
       } /* doit */
       if ((fte->num_files - i) <= fte->max_files)
         break;
@@ -340,6 +345,10 @@
       fte->num_files -= i;
       fte->num_bytes -= bytes;
     } /* doit */
+    if (n2 != NULL) {
+      ftfile_entry_free(n2);
+      n2 = NULL;
+    }
   } /* if */
 
   if (debug)
@@ -354,15 +363,20 @@
    */
 
   if (fte->max_bytes && (fte->num_bytes+curbytes > fte->max_bytes)) {
+    n2 = NULL;
     FT_TAILQ_FOREACH(n1, &fte->head, chain) {
+      if (n2 != NULL) {
+	ftfile_entry_free(n2);
+	n2 = NULL;
+      }
       fterr_info("remove/2 %s", n1->name);
       bytes += n1->size;
       ++i;
       if (doit) {
+        n2 = n1;
         FT_TAILQ_REMOVE(&fte->head, n1, chain);
         if (unlink(n1->name) == -1) 
           fterr_warn("unlink(%s)", n1->name);
-        ftfile_entry_free(n1);
       } /* doit */
       if ((fte->num_bytes+curbytes - bytes) <= fte->max_bytes)
         break;
@@ -371,6 +385,10 @@
       fte->num_files -= i;
       fte->num_bytes -= bytes;
     } /* doit */
+    if (n2 != NULL) {
+      ftfile_entry_free(n2);
+      n2 = NULL;
+    }
   } /* if */
 
   if (debug)
@@ -499,7 +517,7 @@
  * returns -1 on error
  * 
  */
-int ftfile_mkpath(u_int32 ftime, int nest)
+int ftfile_mkpath(time_t ftime, int nest)
 {
   struct tm *tm;
   char buf[32];
@@ -762,13 +780,19 @@
 {
   struct ftfile_entry *n1, *n2;
 
+  n2 = NULL;
   FT_TAILQ_FOREACH(n1, &fte->head, chain) {
+    if (n2 != NULL) {
+      ftfile_entry_free(n2);
+      n2 = NULL;
+    }
     FT_TAILQ_REMOVE(&fte->head, n1, chain);
     n2 = n1;
-    n1 = FT_TAILQ_NEXT(n1, chain);
+  }
+
+  if (n2 != NULL) {
     ftfile_entry_free(n2);
-    if (!n1)
-      break;
+    n2 = NULL;
   }
 
 } /* ftfile_free */


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709262036.l8QKaiIq081564>