Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142083769
D21450.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D21450.diff
View Options
diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -1132,7 +1132,7 @@
_keywords="start stop restart rcvar enable disable delete enabled describe extracommands $extra_commands"
rc_pid=
_pidcmd=
- _procname=${procname:-${command}}
+ : "${procname:=${command}}"
eval _cpuset=\$${name}_cpuset
@@ -1164,11 +1164,11 @@
fi
# setup pid check command
- if [ -n "$_procname" ]; then
+ if [ -n "$procname" ]; then
if [ -n "$pidfile" ]; then
- _pidcmd='rc_pid=$(check_pidfile '"$pidfile $_procname $command_interpreter"')'
+ _pidcmd='rc_pid=$(check_pidfile '"$pidfile $procname $command_interpreter"')'
else
- _pidcmd='rc_pid=$(check_process '"$_procname $command_interpreter"')'
+ _pidcmd='rc_pid=$(check_process '"$procname $command_interpreter"')'
fi
_keywords="${_keywords} status poll"
else
diff --git a/libexec/rc/tests/rc_subr_test.sh b/libexec/rc/tests/rc_subr_test.sh
--- a/libexec/rc/tests/rc_subr_test.sh
+++ b/libexec/rc/tests/rc_subr_test.sh
@@ -104,8 +104,72 @@
/bin/sh "$__script" "$__name" "$__pidfile" onestop
}
+atf_test_case procname_run_rc_command_start
+procname_run_rc_command_start_head()
+{
+ atf_set "descr" "Verify that \${procname} is available when " \
+ "the service is onestarted via " \
+ "the default implementaion of the start argument " \
+ "in run_rc_command"
+}
+
+procname_run_rc_command_start_body()
+{
+ __name="$(atf_get ident)"
+ __command="/bin/echo"
+ __script=$(mktemp -t "${__name}.script")
+
+ cat >> "$__script" <<-'LITERAL'
+ . /etc/rc.subr
+ name="$1"
+ command="$2"
+ _rc_arg="$3"
+ command_args='$procname'
+ load_rc_config
+ rc_quiet="YES"
+ rc_startmsgs="NO"
+ run_rc_command "$_rc_arg"
+ LITERAL
+
+ atf_check -s exit:0 -o inline:"${__command}\n" -e empty \
+ /bin/sh "$__script" "$__name" "$__command" onestart
+}
+
+atf_test_case procname_start_cmd_func
+procname_start_cmd_func_head()
+{
+ atf_set "descr" "Verify that \${procname} is available when " \
+ "the service is onestarted via " \
+ "a function in start_cmd"
+}
+
+procname_start_cmd_func_body()
+{
+ __name="$(atf_get ident)"
+ __command="/bin/echo"
+ __script=$(mktemp -t "${__name}.script")
+
+ cat >> "$__script" <<-'LITERAL'
+ . /etc/rc.subr
+ name="$1"
+ command="$2"
+ _rc_arg="$3"
+ start_cmd="procname_start_cmd_func_start"
+ procname_start_cmd_func_start() {
+ "$command" "$procname"
+ }
+ load_rc_config
+ run_rc_command "$_rc_arg"
+ LITERAL
+
+ atf_check -s exit:0 -o inline:"${__command}\n" -e empty \
+ /bin/sh "$__script" "$__name" "$__command" onestart
+}
+
atf_init_test_cases()
{
atf_add_test_case oomprotect_all
atf_add_test_case oomprotect_yes
+ atf_add_test_case procname_run_rc_command_start
+ atf_add_test_case procname_start_cmd_func
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 16, 9:36 PM (17 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27670213
Default Alt Text
D21450.diff (2 KB)
Attached To
Mode
D21450: rc.subr(8): Set procname to command by default to match documentation
Attached
Detach File
Event Timeline
Log In to Comment