On Wed, Jul 01, 2026 at 02:04:14PM +0100, Stuart Henderson wrote:
> On 2026/07/01 12:27, Mikolaj Kucharski wrote:
> > Sometime ago, I think after this year Python upgrades rc.d(8) script
> > stopped working with salt minion (I don't have master on -current
> > OpenBSD). I see that on OpenBSD 7.9 proctitle works correctly, so it
> > was after the 7.9 release.
> 
> I don't know about salt, but setproctitle does work properly on -current
> 
> $ python3
> Python 3.14.6 (main, Jun 28 2026, 14:43:55) [Clang 22.1.6 ] on openbsd7
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import setproctitle
> >>> setproctitle.setproctitle('foo')
> >>>
> 
> $ pgrep -lf python3
> 52780 python3: foo
> <snip others>
> 

Here is a very minimal patch to fix the rc.d(8) proc title issue.


Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/salt/Makefile,v
diff -u -p -u -r1.201 Makefile
--- Makefile    28 Feb 2026 07:01:30 -0000      1.201
+++ Makefile    12 Jul 2026 20:38:52 -0000
@@ -17,6 +17,7 @@ COMMENT =             remote execution and configur
 
 MODPY_DISTV =          3007.13
 DISTNAME =             salt-${MODPY_DISTV}
+REVISION =             0
 
 CATEGORIES =           sysutils net devel
 
Index: patches/patch-salt_scripts_py
===================================================================
RCS file: patches/patch-salt_scripts_py
diff -N patches/patch-salt_scripts_py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-salt_scripts_py       12 Jul 2026 20:38:52 -0000
@@ -0,0 +1,33 @@
+Force the multiprocessing "fork" start method.  Python 3.14 changed the
+POSIX default to "forkserver" (cpython gh-84559), which breaks Salt's
+fork-based process model, setproctitle output and rc.d(8) pgrep matching.
+
+Index: salt/scripts.py
+--- salt/scripts.py.orig
++++ salt/scripts.py
+@@ -5,6 +5,7 @@ This module contains the function calls to execute com
+ import contextlib
+ import functools
+ import logging
++import multiprocessing
+ import os
+ import signal
+ import subprocess
+@@ -16,6 +17,17 @@ from random import randint
+ 
+ import salt.defaults.exitcodes
+ from salt.exceptions import SaltClientError, SaltReqTimeoutError, 
SaltSystemExit
++
++if sys.platform != "win32":
++    # Salt's process model (ProcessManager, appendproctitle, signal
++    # escalation, daemonization) assumes fork semantics.  Python 3.14
++    # changed the default POSIX start method from "fork" to "forkserver"
++    # (https://github.com/python/cpython/issues/84559), which breaks
++    # process titles and process supervision.  Force "fork" explicitly.
++    try:
++        multiprocessing.set_start_method("fork", force=True)
++    except (RuntimeError, ValueError):
++        pass
+ 
+ log = logging.getLogger(__name__)
+ 


-- 
Regards,
 Mikolaj

Reply via email to