git: d0f0a3b89b93 - main - etc/rc.subr: svcj - use the filename for services

From: Alexander Leidinger <netchild_at_FreeBSD.org>
Date: Fri, 14 Aug 2026 07:59:16 UTC
The branch main has been updated by netchild:

URL: https://cgit.FreeBSD.org/src/commit/?id=d0f0a3b89b932b776b76278fa6885f19e8b30cbb

commit d0f0a3b89b932b776b76278fa6885f19e8b30cbb
Author:     Alexander Leidinger <netchild@FreeBSD.org>
AuthorDate: 2026-08-14 07:49:35 +0000
Commit:     Alexander Leidinger <netchild@FreeBSD.org>
CommitDate: 2026-08-14 07:49:35 +0000

    etc/rc.subr: svcj - use the filename for services
    
    We have ports and basesystem services, where the internal name and the
    filename differ. While the documentation recommends to keep them in
    sync, the reality is different. For service jails use the basename of
    the service filename.
    Fixes:          2efbd48 rc: add service jails framework
    Suggested by:   joneum
    MFC after:      1 week
    MFC to:         stable/15
---
 libexec/rc/rc.subr | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index 0602178f42b4..9b08232e554a 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -1411,8 +1411,8 @@ run_rc_command()
 						fi
 						if [ ${_do_jailing} -eq 1 ]; then
 							$JAIL_CMD -c $_svcj_generic_params $_svcj_cmd_options \
-							    exec.start="${SERVICE} -E _rc_svcj=jailing ${name} ${_rc_prefix}start $rc_extra_args" \
-							    exec.stop="${SERVICE} -E _rc_svcj=jailing ${name} ${_rc_prefix}stop $rc_extra_args" \
+							    exec.start="${SERVICE} -E _rc_svcj=jailing ${rc_service##*/} ${_rc_prefix}start $rc_extra_args" \
+							    exec.stop="${SERVICE} -E _rc_svcj=jailing ${rc_service##*/} ${_rc_prefix}stop $rc_extra_args" \
 							    exec.consolelog="/var/log/svcj_${name}_console.log" \
 							    name=svcj-${name} && _return=0
 						fi
@@ -1422,7 +1422,7 @@ run_rc_command()
 					;;
 				stop)
 					if [ "${_rc_svcj}" != jailing ]; then
-						$SERVICE -E _rc_svcj=jailing -j svcj-${name} ${name} ${_rc_prefix}stop $rc_extra_args || _return=1
+						$SERVICE -E _rc_svcj=jailing -j svcj-${name} ${rc_service##*/} ${_rc_prefix}stop $rc_extra_args || _return=1
 						$JAIL_CMD -r svcj-${name} 2>/dev/null
 					else
 						_run_rc_doit "$_cmd $rc_extra_args" || _return=1
@@ -1433,7 +1433,7 @@ run_rc_command()
 					eval _rc_svcj_extra_cmd=\$${name}_${rc_arg}_svcj_enable
 					: ${_rc_svcj_extra_cmd:=NO}
 					if checkyesno _rc_svcj_extra_cmd && [ "${_rc_svcj}" != jailing ]; then
-						$SERVICE -v -E _rc_svcj=jailing -j svcj-${name} ${name} ${_rc_prefix}${rc_arg} $rc_extra_args || _return=1
+						$SERVICE -v -E _rc_svcj=jailing -j svcj-${name} ${rc_service##*/} ${_rc_prefix}${rc_arg} $rc_extra_args || _return=1
 					else
 						_run_rc_doit "$_cmd $rc_extra_args" || _return=1
 					fi
@@ -1513,8 +1513,8 @@ run_rc_command()
 						fi
 					fi
 					$JAIL_CMD -c $_svcj_generic_params $_svcj_cmd_options\
-					    exec.start="${SERVICE} -E _rc_svcj=jailing ${name} ${_rc_prefix}start $rc_extra_args" \
-					    exec.stop="${SERVICE} -E _rc_svcj=jailing ${name} ${_rc_prefix}stop $rc_extra_args" \
+					    exec.start="${SERVICE} -E _rc_svcj=jailing ${rc_service##*/} ${_rc_prefix}start $rc_extra_args" \
+					    exec.stop="${SERVICE} -E _rc_svcj=jailing ${rc_service##*/} ${_rc_prefix}stop $rc_extra_args" \
 					    exec.consolelog="/var/log/svcj_${name}_console.log" \
 					    name=svcj-${name} || return 1
 				fi