Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 918912 - dev-java/commons-daemon-1.3.4 - [clang] failed with "Modern C testing" (compile phase): - jsvc-unix.c: error: incompatible function pointer types assigning to
Summary: dev-java/commons-daemon-1.3.4 - [clang] failed with "Modern C testing" (compi...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: c99-porting
  Show dependency tree
 
Reported: 2023-11-30 17:27 UTC by Toralf Förster
Modified: 2023-12-02 21:29 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,17.42 KB, text/plain)
2023-11-30 17:27 UTC, Toralf Förster
Details
dev-java:commons-daemon-1.3.4:20231130-104642.log (dev-java:commons-daemon-1.3.4:20231130-104642.log,9.08 KB, text/plain)
2023-11-30 17:27 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,36.19 KB, text/plain)
2023-11-30 17:27 UTC, Toralf Förster
Details
environment (environment,142.22 KB, text/plain)
2023-11-30 17:27 UTC, Toralf Förster
Details
etc.clang.tar.xz (etc.clang.tar.xz,1.13 KB, application/x-xz)
2023-11-30 17:27 UTC, Toralf Förster
Details
etc.portage.tar.xz (etc.portage.tar.xz,20.48 KB, application/x-xz)
2023-11-30 17:27 UTC, Toralf Förster
Details
logs.tar.xz (logs.tar.xz,3.06 KB, application/x-xz)
2023-11-30 17:27 UTC, Toralf Förster
Details
qlist-info.txt (qlist-info.txt,97.05 KB, text/plain)
2023-11-30 17:27 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2023-11-30 17:27:15 UTC
      |         ^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
jsvc-unix.c:1093:9: warning: ignoring return value of function declared with
      'warn_unused_result' attribute [-Wunused-result]
 1093 |         freopen("/dev/null", "a", stderr);
      |         ^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~
clang -O2 -pipe -march=native -fno-diagnostics-color -Werror=implicit-function-declaration -Werror=implicit-int -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes -DHAVE_LIBCAP   -I/opt/openjdk-bin-21.0.1_p12/include -I/opt/openjdk-bin-21.0.1_p12/include/linux -c dso-dyld.c -o dso-dyld.o
jsvc-unix.c:1311:20: error: incompatible function pointer types assigning to
      '__sighandler_t' (aka 'void (*)(int)') from 'void (int, siginfo_t *, void
      *)' [-Wincompatible-function-pointer-types]

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.1_desktop_systemd_merged_usr-20231128-203237

  -------------------------------------------------------------------

CC=clang
CXX=clang++
gcc-config -l:
 [1] x86_64-pc-linux-gnu-13 *
clang/llvm (if any):
clang version 17.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/17/bin
Configuration file: /etc/clang/x86_64-pc-linux-gnu-clang.cfg
/usr/lib/llvm/17
17.0.6
Python 3.11.6
Available Ruby profiles:
  [1]   ruby31 (with Rubygems) *
Available Rust versions:
  [1]   rust-bin-1.73.0 *
GENTOO_VM=openjdk-bin-21  CLASSPATH="" JAVA_HOME="/opt/openjdk-bin-21.0.1_p12"
JAVACFLAGS="-source 1.8 -target 1.8" COMPILER=""
The following VMs are available for generation-2:
*)	Eclipse Temurin JDK 21.0.1_p12 [openjdk-bin-21]
Available Java Virtual Machines:
  [1]   openjdk-bin-21  system-vm

php cli (if any):
go version go1.21.4 linux/amd64

  HEAD of ::gentoo
commit aa44b1d11312a24c718788d7f848707685e971f0
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Thu Nov 30 10:16:57 2023 +0000

    2023-11-30 10:16:57 UTC

emerge -qpvO dev-java/commons-daemon
[ebuild  N    ] dev-java/commons-daemon-1.3.4  USE="-doc -source -test -verify-sig"
Comment 1 Toralf Förster gentoo-dev 2023-11-30 17:27:16 UTC
Created attachment 875992 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2023-11-30 17:27:17 UTC
Created attachment 875993 [details]
dev-java:commons-daemon-1.3.4:20231130-104642.log
Comment 3 Toralf Förster gentoo-dev 2023-11-30 17:27:18 UTC
Created attachment 875994 [details]
emerge-history.txt
Comment 4 Toralf Förster gentoo-dev 2023-11-30 17:27:20 UTC
Created attachment 875995 [details]
environment
Comment 5 Toralf Förster gentoo-dev 2023-11-30 17:27:21 UTC
Created attachment 875996 [details]
etc.clang.tar.xz
Comment 6 Toralf Förster gentoo-dev 2023-11-30 17:27:21 UTC
Created attachment 875997 [details]
etc.portage.tar.xz
Comment 7 Toralf Förster gentoo-dev 2023-11-30 17:27:22 UTC
Created attachment 875998 [details]
logs.tar.xz
Comment 8 Toralf Förster gentoo-dev 2023-11-30 17:27:23 UTC
Created attachment 875999 [details]
qlist-info.txt
Comment 9 Holger Hoffstätte 2023-11-30 22:22:47 UTC
Unless I'm too sleepy, this code is plain wrong. Line 1311 assigns the "controller" callback to act.sa_handler, which expects a pointer to a function taking a single int (like e.g. "handler", #89).

When the signal handler function needs access to additional signal information and SA_SIGINFO is specified in act.sa_flags (#1313) the function must be assigned to act.sa_sigaction instead:

diff --git a/src/native/unix/native/jsvc-unix.c b/src/native/unix/native/jsvc-unix.c
index e331a0f..187e404 100644
--- a/src/native/unix/native/jsvc-unix.c
+++ b/src/native/unix/native/jsvc-unix.c
@@ -1308,7 +1308,7 @@ static int run_controller(arg_data *args, home_data *data, uid_t uid, gid_t gid)
      * These will be replaced in the child process.
      */
     memset(&act, '\0', sizeof(act));
-    act.sa_handler = controller;
+    act.sa_sigaction = controller;
     sigemptyset(&act.sa_mask);
     act.sa_flags = SA_RESTART | SA_NOCLDSTOP | SA_SIGINFO;
 
Doing so lets the file compile with clang. For more see man sigaction(2) "The siginfo_t argument to a SA_SIGINFO handler".

Anybody going in there should probably also fix the "unused return value" warnings for extra credit. :)