[packages/java-commons-daemon] Rel 3
arekm
arekm at pld-linux.org
Sat May 16 02:39:51 CEST 2026
commit 559954923d71adaa1b4f8e1ae230a9c40ec3bda4
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat May 16 02:39:25 2026 +0200
Rel 3
java-commons-daemon.spec | 4 +++-
pidfile-open-rdwr.patch | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 1 deletion(-)
---
diff --git a/java-commons-daemon.spec b/java-commons-daemon.spec
index f9dd07c..837748e 100644
--- a/java-commons-daemon.spec
+++ b/java-commons-daemon.spec
@@ -8,7 +8,7 @@ Summary: Commons Daemon - controlling of Java daemons
Summary(pl.UTF-8): Commons Daemon - kontrolowanie demonów w Javie
Name: java-commons-daemon
Version: 1.5.1
-Release: 2
+Release: 3
License: Apache v2.0
Group: Libraries/Java
# -Source0: http://www.apache.org/dist/commons/daemon/source/commons-daemon-%{version}-src.tar.gz
@@ -17,6 +17,7 @@ Source0: https://archive.apache.org/dist/commons/daemon/source/commons-daemon-%{
# Ant build file for building without Maven
Source1: build.xml
Patch0: stdbool.patch
+Patch1: pidfile-open-rdwr.patch
URL: https://commons.apache.org/proper/commons-daemon/
BuildRequires: ant >= 1.4.1
BuildRequires: autoconf >= 2.53
@@ -73,6 +74,7 @@ Dokumentacja do Commons Daemon.
%prep
%setup -q -n %{srcname}-%{version}-src
%patch -P0 -p1
+%patch -P1 -p1
cp -a %{SOURCE1} .
%build
diff --git a/pidfile-open-rdwr.patch b/pidfile-open-rdwr.patch
new file mode 100644
index 0000000..ab1bb3e
--- /dev/null
+++ b/pidfile-open-rdwr.patch
@@ -0,0 +1,34 @@
+jsvc: open pidfile O_RDWR so lockf(F_LOCK) can take an exclusive lock
+
+lockf(F_LOCK, ...) acquires an exclusive (write) lock; on Linux glibc the
+fcntl backend rejects it with EBADF when the underlying fd was opened
+O_RDONLY. wait_child() and get_pidf() open the pidfile read-only and then
+call lockf(F_LOCK), which always fails with errno 9 ("Bad file descriptor")
+on Linux. The lockf return value was ignored prior to 1.5.x; 1.5.1 started
+checking it, so the long-standing bug now aborts startup ("wait_child:
+Failed to lock PID file ... due to [9]").
+
+Open the pidfile O_RDWR in both call sites so the exclusive lock request
+matches the open mode. Both callers run as root in the jsvc parent
+process, so RDWR access is granted.
+
+--- commons-daemon-1.5.1-src/src/native/unix/native/jsvc-unix.c.orig
++++ commons-daemon-1.5.1-src/src/native/unix/native/jsvc-unix.c
+@@ -673,7 +673,7 @@
+ int i;
+ char buff[80];
+
+- fd = open(args->pidf, O_RDONLY, 0);
++ fd = open(args->pidf, O_RDWR, 0);
+ if (!quiet)
+ log_debug("get_pidf: %d in %s", fd, args->pidf);
+ if (fd < 0) {
+@@ -778,7 +778,7 @@
+ }
+
+ /* check if the pid file process exists */
+- fd = open(args->pidf, O_RDONLY);
++ fd = open(args->pidf, O_RDWR);
+ if (fd < 0 && havejvm) {
+ /* something has gone wrong the JVM has stopped */
+ return 1;
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/java-commons-daemon.git/commitdiff/559954923d71adaa1b4f8e1ae230a9c40ec3bda4
More information about the pld-cvs-commit
mailing list