[DragonFlyBSD - Bug #3328] rcenable will not add `_enable` prefix

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Fri Jan 6 11:20:32 PST 2023

Issue #3328 has been updated by daftaupe.

Hmm several comments on that one after a few minutes of research.

A weirder thing is that the behaviour or rcenable is different depending on the program it tries to act on.
For dhcpcd I reproduced, I only get dhcpcd="YES" in my /etc/rc.conf file.
I tried with some other daemon, for example sshd, that gives an error but adds a similar non-prefixed variable.
# rcenable sshd
[: =: unexpected operator
added/modified: sshd=YES
Running /etc/rc.d/sshd start
sshd already running? (pid=632).
# grep sshd /etc/rc.conf
sshd=YES	# rcrun enable sshd

I tried with a port I had called xrdp, that one did end up being added to rc.conf as xrpd_enable=YES

I compared the rc.d scripts of these 3 and read some parts of manual pages, and
- from rc(8) : 
rcvar        Display which rc.conf(5) variables are used to control
             the startup of the service (if any).
-> what appears in rc.conf is defined by the rcvar value in the script, xrdp has rcvar=xrdp_enable and appears as such, sshd has rcvar=`set_rcvar`, same for dhcpcd when it's run in master mode (that is without giving the script an interface name)
- our rc manual page differs from FreeBSD one, where ours mentions rcvar=`set_rcvar` in EXAMPLES section, FreeBSD's has no mention of this as you can check in https://www.freebsd.org/cgi/man.cgi?query=rc&sektion=8. Instead in the examples, they write rcvar=foo_enable as in their page : https://docs.freebsd.org/en/articles/rc-scripting/#rcng-hookup

rcrun(8) gives the following concerning the enable command
enable       Sets the corresponding _enable variable in rc.conf(5) to
             "YES" and runs the start command.
So one might expect to see the _enable suffixed variable in rc.conf, but, having the variable without the _enable suffix is sufficient to let the program start, so I guess maybe that manpage should be modified ?

So maybe we're a bit on a hybrid situation where we have some things originating from FreeBSD and some others from FreeBSD leading to that non-homogen behaviour.

It looks like there's a port called rclint that is supposed to be a linter for rc scripts, but to which flavour does it apply to, is a question I have no answer to (probably FreeBSD though).

Bug #3328: rcenable will not add `_enable` prefix

* Author: mneumann
* Status: Feedback
* Priority: Normal
* Target version: 6.4
* Start date: 2022-09-13
When I run

rcenable dhcpcd

I get the following line added to rc.conf:


While I'd expect it to be:


You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

More information about the Bugs mailing list