Merge branch 'collectd-4.10' into collectd-5.0
authorFlorian Forster <octo@collectd.org>
Sun, 19 Feb 2012 10:11:28 +0000 (11:11 +0100)
committerFlorian Forster <octo@collectd.org>
Sun, 19 Feb 2012 10:11:28 +0000 (11:11 +0100)
Conflicts:
ChangeLog
version-gen.sh

Change-Id: Id72b28eb1432835ab710d1f551bb886d0638e079

ChangeLog
configure.in
src/exec.c
src/network.c

index 4642da9..6b57f66 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * v5upgrade target: Target for converting v4 data sets to the v5
          schema.
 
+2012-02-19, Version 4.10.6
+       * Build system: Fix problems when building the ipvs and iptables
+         plugins. Thanks to Sebastian Harl for his patch. A bashism in the
+         version-gen.sh script has been fixed. Thanks to Jo-Philipp Wich for
+         his patch.
+       * csv and rrdtool plugins: Print a more helpful error message when the
+         DataDir is a symlink pointing to a non-existing location. Thanks to
+         Jonathan Nieder for his patch.
+       * exec plugin: Fix a problem when using select(2) to read from file
+         handles. Thanks to Gerrie Roos for his patch.
+       * network plugin: An incorrect error message in the handling of the
+         "Interface" configuration option has been fixed. Thanks to Gerrie
+         Roos for his patch.
+       * oracle plugin: A potential endless loop in the error handling has
+         been fixed.
+       * python plugin: A crash bug in the configuration handling has been
+         fixed. Thanks to Sven Trenkel for his patch.
+       * interfaces plugin: The change which was supposed to ignore "bogus"
+         interfaces has been reverted, since it ignored legit interfaces, such
+         as bonding pseudo-devices as well.
+
 2012-01-21, Version 4.10.5
        * curl_xml plugin: Fix handling of file:// and other URLs (which don't
          follow HTTP status codes). Thanks to Fabien Wernli for his patch!
index 8040193..265d503 100644 (file)
@@ -1783,114 +1783,120 @@ AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
 # }}}
 
 # --with-libiptc {{{
-with_own_libiptc="no"
 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
 [
        if test "x$withval" = "xshipped"
        then
-               with_own_libiptc="yes"
-               with_libiptc="yes"
-       else if test "x$withval" != "xno" && test "x$withval" != "xyes"
+               with_libiptc="own"
+       else if test "x$withval" = "xyes"
        then
-               LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS -I$withval/include"
-               LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS -L$withval/lib"
-               with_libiptc="yes"
+               with_libiptc="pkgconfig"
+       else if test "x$withval" = "xno"
+       then
+               with_libiptc="no"
        else
-               with_libiptc="$withval"
-       fi; fi
+               with_libiptc="yes"
+               with_libiptc_cflags="-I$withval/include"
+               with_libiptc_libs="-L$withval/lib"
+       fi; fi; fi
 ],
 [
        if test "x$ac_system" = "xLinux"
        then
-               with_libiptc="yes"
+               with_libiptc="pkgconfig"
        else
                with_libiptc="no (Linux only)"
        fi
 ])
-SAVE_CPPFLAGS="$CPPFLAGS"
-SAVE_LDFLAGS="$LDFLAGS"
-CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
-LDFLAGS="$LDFLAGS $LIBIPTC_LDFLAGS"
-# check whether the header file for libiptc is available.
-if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
+
+if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
 then
-       AC_CHECK_HEADERS(libiptc/libiptc.h,
-       [
-               AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
-       ],
-       [
-               with_libiptc="yes"
-               with_own_libiptc="yes"
-       ])
+       with_libiptc="no (Don't have pkg-config)"
 fi
-if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
+
+if test "x$with_libiptc" = "xpkgconfig"
 then
-       AC_CHECK_HEADERS(libiptc/libip6tc.h,
-       [
-               AC_DEFINE(HAVE_LIBIPTC_LIBIP6TC_H, 1, [Define to 1 if you have the <libiptc/libip6tc.h> header file.])
-       ],
-       [
-               with_libiptc="yes"
-               with_own_libiptc="yes"
-       ])
+       $PKG_CONFIG --exists 'libiptc' 2>/dev/null
+       if test $? -ne 0
+       then
+               with_libiptc="no (pkg-config doesn't know libiptc)"
+       fi
+fi
+if test "x$with_libiptc" = "xpkgconfig"
+then
+       with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
+       if test $? -ne 0
+       then
+               with_libiptc="no ($PKG_CONFIG failed)"
+       fi
+       with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
+       if test $? -ne 0
+       then
+               with_libiptc="no ($PKG_CONFIG failed)"
+       fi
+fi
+
+SAVE_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
+
+# check whether the header file for libiptc is available.
+if test "x$with_libiptc" = "xpkgconfig"
+then
+       AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
+                       [with_libiptc="no (header file missing)"])
 fi
 # If the header file is available, check for the required type declaractions.
 # They may be missing in old versions of libiptc. In that case, they will be
 # declared in the iptables plugin.
-if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
+if test "x$with_libiptc" = "xpkgconfig"
 then
-       AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
-       [
-#if OWN_LIBIPTC
-# include "$srcdir/src/owniptc/libiptc.h"
-# include "$srcdir/src/owniptc/libip6tc.h"
-#else
-# include <libiptc/libiptc.h>
-# include <libiptc/libip6tc.h>
-#endif
-       ])
+       AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
 fi
 # Check for the iptc_init symbol in the library.
-if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
+if test "x$with_libiptc" = "xpkgconfig"
 then
        AC_CHECK_LIB(iptc, iptc_init,
-       [
-               AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
-       ],
-       [
-               with_libiptc="yes"
-               with_own_libiptc="yes"
-       ],
-       [-lip4tc -lip6tc])
+                       [with_libiptc="pkgconfig"],
+                       [with_libiptc="no"],
+                       [$with_libiptc_libs])
+fi
+if test "x$with_libiptc" = "xpkgconfig"
+then
+       with_libiptc="yes"
 fi
-# The system wide version failed for some reason. Check if we have the required
-# headers to build the shipped version.
-if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xyes"
+
+CPPFLAGS="$SAVE_CPPFLAGS"
+
+if test "x$with_libiptc" = "xown"
+then
+       with_libiptc_cflags=""
+       with_libiptc_libs=""
+fi
+if test "x$with_libiptc" = "xown"
 then
        AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
        [
                with_libiptc="no (Linux iptables headers not found)"
-               with_own_libiptc="no"
        ],
        [
 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
        ])
 fi
+AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
+if test "x$with_libiptc" = "xown"
+then
+       AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
+       with_libiptc="yes"
+fi
+
 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
-AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
 if test "x$with_libiptc" = "xyes"
 then
-       BUILD_WITH_LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS"
-       BUILD_WITH_LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS"
+       BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
+       BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
        AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
        AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
 fi
-if test "x$with_own_libiptc" = "xyes"
-then
-       AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
-fi
-CPPFLAGS="$SAVE_CPPFLAGS"
-LDFLAGS="$SAVE_LDFLAGS"
 # }}}
 
 # --with-java {{{
@@ -2262,7 +2268,7 @@ then
 fi
 if test "x$with_libmysql" = "xyes"
 then
-       with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
+       with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
        mysql_config_status=$?
 
        if test $mysql_config_status -ne 0
@@ -4885,11 +4891,6 @@ then
        with_librrd="yes (warning: librrd is not thread-safe)"
 fi
 
-if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xyes"
-then
-       with_libiptc="yes (shipped version)"
-fi
-
 if test "x$with_libperl" = "xyes"
 then
        with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
index 4f6f9df..c5ea155 100644 (file)
@@ -93,7 +93,7 @@ static void sigchld_handler (int __attribute__((unused)) signal) /* {{{ */
     program_list_t *pl;
     for (pl = pl_head; pl != NULL; pl = pl->next)
       if (pl->pid == pid)
-       break;
+        break;
     if (pl != NULL)
       pl->status = status;
   } /* while (waitpid) */
@@ -108,20 +108,20 @@ static int exec_config_exec (oconfig_item_t *ci) /* {{{ */
   if (ci->children_num != 0)
   {
     WARNING ("exec plugin: The config option `%s' may not be a block.",
-       ci->key);
+        ci->key);
     return (-1);
   }
   if (ci->values_num < 2)
   {
     WARNING ("exec plugin: The config option `%s' needs at least two "
-       "arguments.", ci->key);
+        "arguments.", ci->key);
     return (-1);
   }
   if ((ci->values[0].type != OCONFIG_TYPE_STRING)
       || (ci->values[1].type != OCONFIG_TYPE_STRING))
   {
     WARNING ("exec plugin: The first two arguments to the `%s' option must "
-       "be string arguments.", ci->key);
+        "be string arguments.", ci->key);
     return (-1);
   }
 
@@ -201,15 +201,15 @@ static int exec_config_exec (oconfig_item_t *ci) /* {{{ */
     {
       if (ci->values[i + 1].type == OCONFIG_TYPE_NUMBER)
       {
-       ssnprintf (buffer, sizeof (buffer), "%lf",
-           ci->values[i + 1].value.number);
+        ssnprintf (buffer, sizeof (buffer), "%lf",
+            ci->values[i + 1].value.number);
       }
       else
       {
-       if (ci->values[i + 1].value.boolean)
-         sstrncpy (buffer, "true", sizeof (buffer));
-       else
-         sstrncpy (buffer, "false", sizeof (buffer));
+        if (ci->values[i + 1].value.boolean)
+          sstrncpy (buffer, "true", sizeof (buffer));
+        else
+          sstrncpy (buffer, "false", sizeof (buffer));
       }
 
       pl->argv[i] = strdup (buffer);
@@ -254,7 +254,7 @@ static int exec_config (oconfig_item_t *ci) /* {{{ */
   {
     oconfig_item_t *child = ci->children + i;
     if ((strcasecmp ("Exec", child->key) == 0)
-       || (strcasecmp ("NotificationExec", child->key) == 0))
+        || (strcasecmp ("NotificationExec", child->key) == 0))
       exec_config_exec (child);
     else
     {
@@ -303,7 +303,7 @@ static void exec_child (program_list_t *pl) /* {{{ */
   if (status != 0)
   {
     ERROR ("exec plugin: Failed to get user information for user ``%s'': %s",
-       pl->user, sstrerror (errno, errbuf, sizeof (errbuf)));
+        pl->user, sstrerror (errno, errbuf, sizeof (errbuf)));
     exit (-1);
   }
   if (sp_ptr == NULL)
@@ -332,15 +332,15 @@ static void exec_child (program_list_t *pl) /* {{{ */
       status = getgrnam_r (pl->group, &gr, nambuf, sizeof (nambuf), &gr_ptr);
       if (0 != status)
       {
-       ERROR ("exec plugin: Failed to get group information "
-           "for group ``%s'': %s", pl->group,
-           sstrerror (errno, errbuf, sizeof (errbuf)));
-       exit (-1);
+        ERROR ("exec plugin: Failed to get group information "
+            "for group ``%s'': %s", pl->group,
+            sstrerror (errno, errbuf, sizeof (errbuf)));
+        exit (-1);
       }
       if (NULL == gr_ptr)
       {
-       ERROR ("exec plugin: No such group: `%s'", pl->group);
-       exit (-1);
+        ERROR ("exec plugin: No such group: `%s'", pl->group);
+        exit (-1);
       }
 
       egid = gr.gr_gid;
@@ -374,7 +374,7 @@ static void exec_child (program_list_t *pl) /* {{{ */
   if (status != 0)
   {
     ERROR ("exec plugin: setgid (%i) failed: %s",
-       gid, sstrerror (errno, errbuf, sizeof (errbuf)));
+        gid, sstrerror (errno, errbuf, sizeof (errbuf)));
     exit (-1);
   }
 
@@ -384,7 +384,7 @@ static void exec_child (program_list_t *pl) /* {{{ */
     if (status != 0)
     {
       ERROR ("exec plugin: setegid (%i) failed: %s",
-         egid, sstrerror (errno, errbuf, sizeof (errbuf)));
+          egid, sstrerror (errno, errbuf, sizeof (errbuf)));
       exit (-1);
     }
   }
@@ -393,7 +393,7 @@ static void exec_child (program_list_t *pl) /* {{{ */
   if (status != 0)
   {
     ERROR ("exec plugin: setuid (%i) failed: %s",
-       uid, sstrerror (errno, errbuf, sizeof (errbuf)));
+        uid, sstrerror (errno, errbuf, sizeof (errbuf)));
     exit (-1);
   }
 
@@ -435,7 +435,7 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
   if (status != 0)
   {
     ERROR ("exec plugin: pipe failed: %s",
-       sstrerror (errno, errbuf, sizeof (errbuf)));
+        sstrerror (errno, errbuf, sizeof (errbuf)));
     return (-1);
   }
 
@@ -443,7 +443,7 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
   if (status != 0)
   {
     ERROR ("exec plugin: pipe failed: %s",
-       sstrerror (errno, errbuf, sizeof (errbuf)));
+        sstrerror (errno, errbuf, sizeof (errbuf)));
     return (-1);
   }
 
@@ -451,7 +451,7 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
   if (status != 0)
   {
     ERROR ("exec plugin: pipe failed: %s",
-       sstrerror (errno, errbuf, sizeof (errbuf)));
+        sstrerror (errno, errbuf, sizeof (errbuf)));
     return (-1);
   }
 
@@ -459,7 +459,7 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
   if (pid < 0)
   {
     ERROR ("exec plugin: fork failed: %s",
-       sstrerror (errno, errbuf, sizeof (errbuf)));
+        sstrerror (errno, errbuf, sizeof (errbuf)));
     return (-1);
   }
   else if (pid == 0)
@@ -472,9 +472,9 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
     for (fd = 0; fd < fd_num; fd++)
     {
       if ((fd == fd_pipe_in[0])
-         || (fd == fd_pipe_out[1])
-         || (fd == fd_pipe_err[1]))
-       continue;
+          || (fd == fd_pipe_out[1])
+          || (fd == fd_pipe_err[1]))
+        continue;
       close (fd);
     }
 
@@ -578,10 +578,18 @@ static void *exec_read_one (void *arg) /* {{{ */
   /* We use a copy of fdset, as select modifies it */
   copy = fdset;
 
-  while (select(highest_fd + 1, &copy, NULL, NULL, NULL ) > 0)
+  while (1)
   {
     int len;
 
+    status = select (highest_fd + 1, &copy, NULL, NULL, NULL);
+    if (status < 0)
+    {
+      if (errno == EINTR)
+        continue;
+      break;
+    }
+
     if (FD_ISSET(fd, &copy))
     {
       char *pnl;
@@ -632,14 +640,14 @@ static void *exec_read_one (void *arg) /* {{{ */
       }
       else if (len == 0)
       {
-       /* We've reached EOF */
-       NOTICE ("exec plugin: Program `%s' has closed STDERR.",
-           pl->exec);
-       close (fd_err);
-       FD_CLR (fd_err, &fdset);
-       highest_fd = fd;
-       fd_err = -1;
-       continue;
+        /* We've reached EOF */
+        NOTICE ("exec plugin: Program `%s' has closed STDERR.",
+            pl->exec);
+        close (fd_err);
+        FD_CLR (fd_err, &fdset);
+        highest_fd = fd;
+        fd_err = -1;
+        continue;
       }
 
       pbuffer_err[len] = '\0';
@@ -713,7 +721,7 @@ static void *exec_notification_one (void *arg) /* {{{ */
   {
     char errbuf[1024];
     ERROR ("exec plugin: fdopen (%i) failed: %s", fd,
-       sstrerror (errno, errbuf, sizeof (errbuf)));
+        sstrerror (errno, errbuf, sizeof (errbuf)));
     kill (pl->pid, SIGTERM);
     pl->pid = 0;
     close (fd);
@@ -756,7 +764,7 @@ static void *exec_notification_one (void *arg) /* {{{ */
       fprintf (fh, "%s: %e\n", meta->name, meta->nm_value.nm_double);
     else if (meta->type == NM_TYPE_BOOLEAN)
       fprintf (fh, "%s: %s\n", meta->name,
-         meta->nm_value.nm_boolean ? "true" : "false");
+          meta->nm_value.nm_boolean ? "true" : "false");
   }
 
   fprintf (fh, "\n%s\n", n->message);
@@ -839,7 +847,7 @@ static int exec_notification (const notification_t *n, /* {{{ */
       continue;
 
     pln = (program_list_and_notification_t *) malloc (sizeof
-       (program_list_and_notification_t));
+        (program_list_and_notification_t));
     if (pln == NULL)
     {
       ERROR ("exec plugin: malloc failed.");
index a19b586..e0c329c 100644 (file)
@@ -1703,9 +1703,9 @@ static int network_set_interface (const sockent_t *se, const struct addrinfo *ai
        }
 
        /* else: Not a multicast interface. */
-#if defined(HAVE_IF_INDEXTONAME) && HAVE_IF_INDEXTONAME && defined(SO_BINDTODEVICE)
        if (se->interface != 0)
        {
+#if defined(HAVE_IF_INDEXTONAME) && HAVE_IF_INDEXTONAME && defined(SO_BINDTODEVICE)
                char interface_name[IFNAMSIZ];
 
                if (if_indextoname (se->interface, interface_name) == NULL)
@@ -1722,20 +1722,21 @@ static int network_set_interface (const sockent_t *se, const struct addrinfo *ai
                                        sstrerror (errno, errbuf, sizeof (errbuf)));
                        return (-1);
                }
-       }
 /* #endif HAVE_IF_INDEXTONAME && SO_BINDTODEVICE */
 
 #else
-       WARNING ("network plugin: Cannot set the interface on a unicast "
+               WARNING ("network plugin: Cannot set the interface on a unicast "
                        "socket because "
 # if !defined(SO_BINDTODEVICE)
-                       "the the \"SO_BINDTODEVICE\" socket option "
+                       "the \"SO_BINDTODEVICE\" socket option "
 # else
                        "the \"if_indextoname\" function "
 # endif
                        "is not available on your system.");
 #endif
 
+       }
+
        return (0);
 } /* }}} network_set_interface */