Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Sep 2015 22:51:36 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 202862] category/port: sysutils/rsyslog8
Message-ID:  <bug-202862-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202862

            Bug ID: 202862
           Summary: category/port: sysutils/rsyslog8
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: brd@FreeBSD.org
          Reporter: fbsd.bugzilla@fenyo.net
             Flags: maintainer-feedback?(brd@FreeBSD.org)
          Assignee: brd@FreeBSD.org

rsyslog makes use of the inotify kernel mechanism when available.

Linux and FreeBSD do not support the inotify mechanism the same way:
- on Linux, inotify_init(2) is a system call;
- on FreeBSD, inotify_init(3) is a library call defined in
/usr/local/lib/libinotify.so, installed by the port named devel/libinotify.

The configure.ac file of the rsyslog8 source distribution checks:
- that there is a header file containing the inotify_init() prototype;
- that a program can be linked to the external function symbol _inotify_init.

BUT this configure.ac makes the assumption that this symbol is part of libc
because it is a syscall, so it doesn't use AC_CHECK_LIB to check for the symbol
in a particular library.

As a consequence, if the port devel/libinotify is installed prior to
sysutils/rsyslog8, the rsyslog8 configure script will find that:

1- the header file containing the prototype of inotify_init() is installed,
thus it will add '#define HAVE_SYS_INOTIFY_H 1' in config.h

2- but the _inotify_init symbol is not available, so it will NOT add '#define
HAVE_INOTIFY_INIT 1' in config.h

On a FreeBSD system on which the libinotify port is not installed, both of
HAVE_INOTIFY_INIT and HAVE_SYS_INOTIFY_H are undefined and the program compiles
correctly.

But on the contrary, on a FreeBSD system on which the libinotify port is
already installed, the sysutils/rsyslog8 port creates a config.h only defining
HAVE_INOTIFY_INIT.

This produces a compilation error because the file
work/rsyslog-8.11.0/plugins/imfile/imfile.c, after having been patched by the
port when the port Makefile processes the diff file
sysutils/rsyslog8/files/patch-plugins_imfile_imfile.c, makes use of
HAVE_SYS_INOTIFY_H to avoid compiling some lines that need some data structures
only defined previously when the inotify_init syscall is present.
So the make command stops with the following error:
imfile.c:1873:5: error: use of undeclared identifier 'dirs'
        if(dirs != NULL) {
[...]      ^

To avoid this behaviour, the
sysutils/rsyslog8/files/patch-plugins_imfile_imfile.c must use both
HAVE_INOTIFY_INIT and HAVE_SYS_INOTIFY_H, not only HAVE_SYS_INOTIFY_H.

So to correct the port, you just need to replace the following line in
sysutils/rsyslog8/files/patch-plugins_imfile_imfile.c:

+#ifdef HAVE_SYS_INOTIFY_H

by the following one:

+#if defined HAVE_SYS_INOTIFY_H && defined HAVE_INOTIFY_INIT

Sincerely,
Alexandre Fenyo

ps: this will let the port compile correctly, avoiding the compilation error,
but this will not let the port be linked to libinotify even if previously
installed. For the port to be able to be linked to libinotify, more work is
necessary:
1- adding an option in the port Makefile (using OPTIONS_DEFINE, *LIB_DEPENDS,
*CONFIGURE_ENABLE and *PLIST_FILES);
2- patching the rsyslog8 configure.ac file, to add AC_SEARCH_LIBS or
AC_CHECK_LIB macro to prepend -linotify to the LIBS variable, when the library
is available.

-- 
You are receiving this mail because:
You are the assignee for the bug.



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