Seven years ago I tried to restart a configuration file and it didn't
work out: https://marc.info/?l=openbsd-tech&m=147318006722787&w=2

This morning I tried to disable a different configuration file and got
similar results. Maybe my hands get too used to typing ".conf" when I
am fiddling with config files and restarting services. Or maybe I have
the mind of a LISP programmer, to whom code and data are the same
thing. But if I have not stopped passing config files to rcctl after
seven years I will probably never stop, so we should fix the error
message again.

Test cases:

# rcctl disable foo.bar
# rcctl set foo.bar status off

Compare the error messages before and after the patch.


diff --git usr.sbin/rcctl/rcctl.sh usr.sbin/rcctl/rcctl.sh
index fb87943ba00..489c0217c45 100644
--- usr.sbin/rcctl/rcctl.sh
+++ usr.sbin/rcctl/rcctl.sh
@@ -541,6 +541,12 @@ case ${action} in
                                svc_is_avail ${svc} || \
                                        rcctl_err "service ${svc} does not 
exist" 2
                        done
+               else
+                       # But you still have to catch invalid characters
+                       for svc in ${svcs}; do
+                               _rc_check_name "${svc}" || \
+                                       rcctl_err "service ${svc} does not 
exist" 2
+                       done
                fi
                ;;
        get|getdef)
@@ -572,6 +578,9 @@ case ${action} in
                if [ "${action} ${var} ${args}" != "set status off" ]; then
                        svc_is_avail ${svc} || \
                                rcctl_err "service ${svc} does not exist" 2
+               else
+                       _rc_check_name "${svc}" || \
+                               rcctl_err "service ${svc} does not exist" 2
                fi
                [[ ${var} != 
@(class|execdir|flags|logger|rtable|status|timeout|user) ]] && usage
                svc_is_meta ${svc} && [ "${var}" != "status" ] && \

Reply via email to