Bug 220227 - service(8): Do not try to refer to rcvar when it is empty
Summary: service(8): Do not try to refer to rcvar when it is empty
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-23 13:33 UTC by Akinori MUSHA
Modified: 2017-06-23 13:33 UTC (History)
0 users

See Also:


Attachments
patch for service.sh (1.25 KB, patch)
2017-06-23 13:33 UTC, Akinori MUSHA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Akinori MUSHA freebsd_committer 2017-06-23 13:33:17 UTC
Created attachment 183740 [details]
patch for service.sh

If rcvar is not defined in a rc.d script, service(8) still tries to call checkyesno() passing an empty string as a variable name only to see this unmeaningful error message in /var/log/messages: "$ is not set properly - see rc.conf(5)."

Also, name and rcvar should be initialized in case they are not defined in the rc.d script, otherwise the previous values may be used for it.

"service -e" is a good way to reproduce this because it will make the command read all rc.d scripts found in your system.  Note that the message is not output to stderr but to syslog, so check out /var/log/message for it.