Hi

As part of https://github.com/gentoo/gentoo/pull/42906, I have applied the attached patches to the tree.

The second one changes the nginx eclass, specifically the default pidfile set at build time, to restore pre-eclass behaviour.

Cheers,

Louis

From a1635cfded3d2df3ef9802ad13b965be17e46078 Mon Sep 17 00:00:00 2001
From: Louis Sautier <sb...@gentoo.org>
Date: Sun, 6 Jul 2025 19:45:32 +0200
Subject: [PATCH 1/2] www-servers/nginx: fix pidfile in OpenRC service, move
 back to subdir

* Fix the typo in RC_SVCNAME.
* Move back the pidfile to a subdirectory of /run to restore the
  behavior from 108a642ef4da9fa6ae4f0d33580a05cea3f70678.

Please note that the owner of /run/nginx is now root so rootless setup
won't work with the current init script.

Closes: https://github.com/gentoo/gentoo/pull/42906
Closes: https://bugs.gentoo.org/959651
Bug: https://bugs.gentoo.org/939560
Signed-off-by: Louis Sautier <sb...@gentoo.org>
---
 www-servers/nginx/files/nginx-r2.logrotate                  | 2 +-
 www-servers/nginx/files/nginx-r2.service                    | 3 ++-
 www-servers/nginx/files/nginx-r5.initd                      | 6 +++++-
 .../nginx/{nginx-1.29.0.ebuild => nginx-1.29.0-r1.ebuild}   | 0
 4 files changed, 8 insertions(+), 3 deletions(-)
 rename www-servers/nginx/{nginx-1.29.0.ebuild => nginx-1.29.0-r1.ebuild} (100%)

diff --git a/www-servers/nginx/files/nginx-r2.logrotate b/www-servers/nginx/files/nginx-r2.logrotate
index 1f16c41261cb..deb9ce2bd83e 100644
--- a/www-servers/nginx/files/nginx-r2.logrotate
+++ b/www-servers/nginx/files/nginx-r2.logrotate
@@ -6,6 +6,6 @@
 	delaycompress
 	sharedscripts
 	postrotate
-		test -r /run/nginx.pid && kill -s USR1 "$(cat /run/nginx.pid)"
+		test -r /run/nginx/nginx.pid && kill -s USR1 "$(cat /run/nginx/nginx.pid)"
 	endscript
 }
diff --git a/www-servers/nginx/files/nginx-r2.service b/www-servers/nginx/files/nginx-r2.service
index c3afed7bea00..967971697ac0 100644
--- a/www-servers/nginx/files/nginx-r2.service
+++ b/www-servers/nginx/files/nginx-r2.service
@@ -4,7 +4,8 @@ After=network.target remote-fs.target nss-lookup.target
 
 [Service]
 Type=forking
-PIDFile=/run/nginx.pid
+PIDFile=/run/nginx/nginx.pid
+RuntimeDirectory=nginx
 ExecStart=nginx
 
 [Install]
diff --git a/www-servers/nginx/files/nginx-r5.initd b/www-servers/nginx/files/nginx-r5.initd
index 35ace16ed36a..40719cd2ac5f 100644
--- a/www-servers/nginx/files/nginx-r5.initd
+++ b/www-servers/nginx/files/nginx-r5.initd
@@ -13,7 +13,7 @@ NGINX_MAXWAITTIME=${NGINX_MAXWAITTIME:-3}
 
 command="/usr/sbin/nginx"
 start_stop_daemon_args=${NGINX_SSDARGS:-"--wait 1000"}
-pidfile=/run/${RV_SVCNAME}.pid
+pidfile="/run/${RC_SVCNAME}/${RC_SVCNAME}.pid"
 user=${NGINX_USER:-nginx}
 group=${NGINX_GROUP:-nginx}
 retry=${NGINX_TERMTIMEOUT:-"TERM/60/KILL/5"}
@@ -25,6 +25,10 @@ depend() {
 	use net dns logger netmount
 }
 
+start_pre() {
+	checkpath -d -m 0755 -o 0:0 "/run/${RC_SVCNAME}"
+}
+
 stop_pre() {
 	if [ "${RC_CMD}" = "restart" ]; then
 		configtest || return 1
diff --git a/www-servers/nginx/nginx-1.29.0.ebuild b/www-servers/nginx/nginx-1.29.0-r1.ebuild
similarity index 100%
rename from www-servers/nginx/nginx-1.29.0.ebuild
rename to www-servers/nginx/nginx-1.29.0-r1.ebuild
-- 
2.50.0

From 482a88ab3e2346bb89fe1eea0c40c2b96e8d04d4 Mon Sep 17 00:00:00 2001
From: Louis Sautier <sb...@gentoo.org>
Date: Sun, 6 Jul 2025 21:57:07 +0200
Subject: [PATCH 2/2] nginx.eclass: make /run/nginx/nginx.pid the default
 pidfile

This restores pre-eclass behavior, when
108a642ef4da9fa6ae4f0d33580a05cea3f70678 moved the pidfile to a
subfolder of /run.

Signed-off-by: Louis Sautier <sb...@gentoo.org>
Bug: https://bugs.gentoo.org/939560
Bug: https://bugs.gentoo.org/959651
---
 eclass/nginx.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/nginx.eclass b/eclass/nginx.eclass
index d538078f096e..170e7f152af8 100644
--- a/eclass/nginx.eclass
+++ b/eclass/nginx.eclass
@@ -591,7 +591,7 @@ nginx_src_configure() {
 		--conf-path="${EPREFIX}/etc/nginx/nginx.conf"
 		--error-log-path="${EPREFIX}/var/log/nginx/error.log"
 		--http-log-path="${EPREFIX}/var/log/nginx/access.log"
-		--pid-path="${EPREFIX}/run/nginx.pid"
+		--pid-path="${EPREFIX}/run/nginx/nginx.pid"
 		--lock-path="${EPREFIX}/run/lock/nginx.lock"
 		--user=nginx
 		--group=nginx
-- 
2.50.0

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to