NetBSD Problem Report #53527

From kivinen@leimasin.iki.fi  Wed Aug 15 17:47:25 2018
Return-Path: <kivinen@leimasin.iki.fi>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 3E3F97A17C
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 15 Aug 2018 17:47:25 +0000 (UTC)
Message-Id: <201808141240.w7ECe9r5019026@leimasin.iki.fi>
Date: Tue, 14 Aug 2018 15:40:09 +0300 (EEST)
From: kivinen@iki.fi
Reply-To: kivinen@iki.fi
To: gnats-bugs@NetBSD.org
Subject: syslogng does not compile
X-Send-Pr-Version: 3.95

>Number:         53527
>Category:       pkg
>Synopsis:       Trying to compile syslogng fails with error
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 15 17:50:00 +0000 2018
>Last-Modified:  Sat Sep 08 00:05:01 +0000 2018
>Originator:     Tero Kivinen
>Release:        NetBSD 8.0_STABLE
>Organization:
IKI ry
>Environment:
System: NetBSD leimasin.iki.fi 8.0_STABLE NetBSD 8.0_STABLE (GENERIC) #0: Wed Aug 8 19:57:09 EEST 2018 kivinen@leimasin.iki.fi:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

When trying to compile syslogng the compilation fails:

  CC       lib/compat/tests_loggen_libloggen_helper_la-openssl_support.lo
tests/loggen/loggen_helper.c:47:14: warning: implicit declaration of function 'socket' [-Wimplicit-function-declaration]
   int sock = socket(dest_addr->sa_family, sock_type, 0);
              ^
tests/loggen/loggen_helper.c:47:30: error: dereferencing pointer to incomplete type 'struct sockaddr'
   int sock = socket(dest_addr->sa_family, sock_type, 0);
                              ^
tests/loggen/loggen_helper.c:54:20: error: 'SOCK_STREAM' undeclared (first use in this function)
   if (sock_type == SOCK_STREAM)
                    ^
tests/loggen/loggen_helper.c:54:20: note: each undeclared identifier is reported only once for each function it appears in
tests/loggen/loggen_helper.c:63:7: warning: implicit declaration of function 'connect' [-Wimplicit-function-declaration]
   if (connect(sock, dest_addr, dest_addr_len) < 0)
       ^
tests/loggen/loggen_helper.c: In function 'connect_ip_socket':
tests/loggen/loggen_helper.c:90:32: error: 'AF_INET6' undeclared (first use in this function)
   hints.ai_family = use_ipv6 ? AF_INET6 : AF_INET;
                                ^
tests/loggen/loggen_helper.c:90:43: error: 'AF_INET' undeclared (first use in this function)
   hints.ai_family = use_ipv6 ? AF_INET6 : AF_INET;
                                           ^
tests/loggen/loggen_helper.c: In function 'connect_unix_domain_socket':
tests/loggen/loggen_helper.c:144:21: error: 'AF_UNIX' undeclared (first use in this function)
   saun.sun_family = AF_UNIX;
                     ^
  CC       tests/loggen/tests_loggen_libloggen_plugin_la-loggen_plugin.lo
gmake[2]: *** [Makefile:15111: tests/loggen/tests_loggen_libloggen_helper_la-loggen_helper.lo] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [Makefile:17933: all-recursive] Error 1
gmake: *** [Makefile:7334: all] Error 2
*** Error code 2

Stop.
make[2]: stopped in /usr/pkgsrc/sysutils/syslog-ng
*** Error code 1

Stop.
make[1]: stopped in /usr/pkgsrc/sysutils/syslog-ng
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/sysutils/syslog-ng
[1]    24717 exit 1     make update

I think this is because they do not include sys/socket.h. I tried to add 
the include to these test files, which allowed me to get through the compliation
but then the resulting binary did not work, it died immediately on start with 
unsupported syscall error or similar (I think it tried to call NetBSD 1.3 compat 
code for socket interfaces, so I assume there is some other includes missing).

>How-To-Repeat:

Check out sysutil/syslogng and say make update.

>Fix:

Not known. The reason I am trying to update syslogng, is that the previous
version died very quickly after boot because some syscall returned error 
which the syslogng considered fatal, and then it was stuck in busy loop.

The previous error could be seen as:

I/O error occurred while reading; fd='20', error='No buffer space available (55)'

appearing in the log and then syslogng was using 100% of one core after that. 
I am not sure if that issue has already been fixed by this version of syslogng
as I have not been able to get to that far yet.

>Audit-Trail:
From: Tero Kivinen <kivinen@iki.fi>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53527: syslogng does not compile
Date: Wed, 15 Aug 2018 22:01:17 +0300

 gnats-admin@netbsd.org writes:
 > Thank you very much for your problem report.
 > It has the internal identification `pkg/53527'.
 > The individual assigned to look at your
 > report is: pkg-manager. 
 > 
 > >Category:       pkg
 > >Responsible:    pkg-manager
 > >Synopsis:       Trying to compile syslogng fails with error
 > >Arrival-Date:   Wed Aug 15 17:50:00 +0000 2018

 Actually with latest update the syslogng compiles, but crashes
 immediately on start with invalid system call:

 leimasin (22:00) /tmp#ktrace /usr/pkg/sbin/syslog-ng  -p /var/run/syslog-ng.pid -f /usr/pkg/etc/syslog-ng/syslog-ng.conf -F -r -v -d -t -e
 [1]    19441 invalid system call  ktrace /usr/pkg/sbin/syslog-ng -p /var/run/syslog-ng.pid -f  -F -r -v -d -t -
 leimasin (22:00) /tmp#kdump| tail -20
  19441      1 syslog-ng NAMI  "/usr/share/i18n/iconv/iconv.alias.db"
  19441      1 syslog-ng RET   open -1 errno 2 No such file or directory
  19441      1 syslog-ng CALL  open(0x7f7fffac4ee0,0x400000,0)
  19441      1 syslog-ng NAMI  "/usr/share/i18n/iconv/iconv.alias"
  19441      1 syslog-ng RET   open -1 errno 2 No such file or directory
  19441      1 syslog-ng CALL  open(0x7f7fffac3e00,0x400000,0xffac3e24)
  19441      1 syslog-ng NAMI  "/usr/share/i18n/iconv/iconv.alias.db"
  19441      1 syslog-ng RET   open -1 errno 2 No such file or directory
  19441      1 syslog-ng CALL  open(0x7f7fffac4ee0,0x400000,0)
  19441      1 syslog-ng NAMI  "/usr/share/i18n/iconv/iconv.alias"
  19441      1 syslog-ng RET   open -1 errno 2 No such file or directory
  19441      1 syslog-ng CALL  getrlimit(8,0x7f7fffac6580)
  19441      1 syslog-ng RET   getrlimit 0
  19441      1 syslog-ng CALL  setrlimit(8,0x7f7fffac6580)
  19441      1 syslog-ng RET   setrlimit 0
  19441      1 syslog-ng CALL  geteuid
  19441      1 syslog-ng RET   geteuid 0
  19441      1 syslog-ng CALL  compat_13_sigaction13(SIGPIPE,0x7f7fffac6600,0x7f7fffac6620)
  19441      1 syslog-ng RET   compat_13_sigaction13 -1 errno 78 Function not implemented
  19441      1 syslog-ng PSIG  SIGSYS SIG_DFL: code=SI_NOINFO
 leimasin (22:00) /tmp#
 -- 
 kivinen@iki.fi

From: pumpkin <pumpkin12355@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/53527: syslogng does not compile
Date: Thu, 16 Aug 2018 09:27:09 +0300

 --0000000000006d05ed0573878807
 Content-Type: text/plain; charset="UTF-8"

 that's a sign its not including the right header for sigaction.

 --0000000000006d05ed0573878807
 Content-Type: text/html; charset="UTF-8"

 <div dir="ltr"><div>that&#39;s a sign its not including the right header for sigaction.</div></div>

 --0000000000006d05ed0573878807--

From: Filip Hajny <filip@joyent.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53527: syslogng does not compile
Date: Tue, 4 Sep 2018 11:49:39 +0200

 I have double checked the source and it is including signal.h in all =
 files where sigaction is called from (and in libivykis too). I don't =
 know where to take this further.

 #0  0x00007c8d23c6e74a in sigaction () from /usr/lib/libc.so.12
 #1  0x00007c8d23cfe39e in signal () from /usr/lib/libc.so.12
 #2  0x00007c8d24405202 in iv_fd_init () from /usr/pkg/lib/libivykis.so.0
 #3  0x00007c8d244061f5 in iv_init () from /usr/pkg/lib/libivykis.so.0
 #4  0x00007c8d2762f83c in app_startup () at lib/apphook.c:149
 #5  0x0000000000401eaf in main ()

From: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53527: Trying to compile syslogng fails with error
Date: Tue, 4 Sep 2018 14:13:24 +0000

 This is a bad sign:

     getprotobynumber_r((int) d, &proto, buf, sizeof(buf), &res);

 The netbsd version doesn't take this many arguments. without the header
 containing the declaration, it makes an implicit (read: wrong)
 declaration which is ABI-incompatible, but it doesn't show up as a failure yet.

From: Tero Kivinen <kivinen@iki.fi>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/53527: syslogng does not compile
Date: Sat, 8 Sep 2018 03:03:50 +0300

 Filip Hajny writes:
 > The following reply was made to PR pkg/53527; it has been noted by GNATS.
 > 
 > From: Filip Hajny <filip@joyent.com>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: pkg/53527: syslogng does not compile
 > Date: Tue, 4 Sep 2018 11:49:39 +0200
 > 
 >  I have double checked the source and it is including signal.h in all =
 >  files where sigaction is called from (and in libivykis too). I don't =
 >  know where to take this further.
 >  
 >  #0  0x00007c8d23c6e74a in sigaction () from /usr/lib/libc.so.12
 >  #1  0x00007c8d23cfe39e in signal () from /usr/lib/libc.so.12
 >  #2  0x00007c8d24405202 in iv_fd_init () from /usr/pkg/lib/libivykis.so.0
 >  #3  0x00007c8d244061f5 in iv_init () from /usr/pkg/lib/libivykis.so.0
 >  #4  0x00007c8d2762f83c in app_startup () at lib/apphook.c:149
 >  #5  0x0000000000401eaf in main ()

 I think this is the offending code:

 work.x86_64/syslog-ng-3.17.2/lib/signal-handler.c:

 ----------------------------------------------------------------------
 static int
 call_original_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
 {
   static int (*real_sa)(int, const struct sigaction *, struct sigaction *);

   if (real_sa == NULL)
     {
       real_sa = dlsym(RTLD_NEXT, "sigaction");
     }
   return real_sa(signum, act, oldact);
 }
 ----------------------------------------------------------------------

 I assume this code tries to make so that even if someone else tries to
 install sigchld handler it will NOT install that, but instead store
 that handler and call it from the real sigchld handler or something
 like that.

 I think it tries to do that so that if some module or so install
 sigchld handler it does not destroy his own sigchld handler.

 If I say #if 0 for the whole signal-handler.c then the code compiles
 and syslogng starts and seems to work, but I most likely modules or
 something like that might be broken, so that is might not be final
 solution to the issue.
 -- 
 kivinen@iki.fi

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.