Bug 173454 - [patch] service(8) does not respect /etc/rc.conf.d/name
Summary: [patch] service(8) does not respect /etc/rc.conf.d/name
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Allan Jude
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-07 22:40 UTC by Denis Generalov
Modified: 2016-01-12 06:00 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (378 bytes, patch)
2012-11-07 22:40 UTC, Denis Generalov
no flags Details | Diff
patch.txt (360 bytes, text/plain; charset=US-ASCII)
2012-11-09 09:01 UTC, Dennis Generaloff
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Generalov 2012-11-07 22:40:00 UTC
service does not looks at /etc/rc.conf.d/name when generates enabled services list

Fix: patch attached

Patch attached with submission follows:
How-To-Repeat: put <servicename>_enable="YES" or <servicename>_enable="NO" in /etc/rc.conf.d/<servicename> and run service -e
Comment 1 Dennis Generaloff 2012-11-09 09:01:46 UTC
Ouch, this patch is little bit wrong, here new one.
Comment 2 m87carlson 2013-03-01 19:04:06 UTC
I submitted a duplicate bug report the other day, PR bin/176488, and found
this one.

The submitted patch does fix the issue of service -e not reporting rcng
enabled services.

Can this get tested and fixed in 9.1?
Comment 3 Aslak Raanes 2014-04-08 15:16:26 UTC
It seems like this bug still apply to 10.0-RELEASE. Since 
/etc/rc.conf.d/ overrides /etc/rc.conf, using `service -e` will give a 
wrong impression on which services are enabled.


     $ uname -sr
     FreeBSD 10.0-RELEASE

     $ service -e | grep bsnmpd

     $ service bsnmpd rcvar
     # bsnmpd
     #
     bsnmpd_enable="NO"
     #   (default: "")

     $ echo 'bsnmpd_enable="YES"' >> /etc/rc.conf

     $ service -e | grep bsnmpd
     /etc/rc.d/bsnmpd

     $ service bsnmpd rcvar
     # bsnmpd
     #
     bsnmpd_enable="YES"
     #   (default: "")

     $ echo 'bsnmpd_enable="NO"' >> /etc/rc.conf.d/bsnmpd

     $ service -e| grep bsnmpd
     /etc/rc.d/bsnmpd

     $ service bsnmpd rcvar
     # bsnmpd
     #
     bsnmpd_enable="NO"
     #   (default: "")

     $ /etc/rc.d/bsnmpd start
     Cannot 'start' bsnmpd. Set bsnmpd_enable to YES in /etc/rc.conf or 
use 'onestart' instead of 'start'.

     $ echo 'bsnmpd_enable="YES"' >> /etc/rc.conf.d/bsnmpd

     $ service bsnmpd rcvar
     # bsnmpd
     #
     bsnmpd_enable="YES"
     #   (default: "")

     $ echo 'bsnmpd_enable="NO"' >> /etc/rc.conf

     $ grep bsnmpd_enable /etc/rc.conf
     bsnmpd_enable="YES"
     bsnmpd_enable="NO"

     $ cat /etc/rc.conf.d/bsnmpd
     bsnmpd_enable="NO"
     bsnmpd_enable="YES"

     $ service bsnmpd rcvar
     # bsnmpd
     #
     bsnmpd_enable="YES"
     #   (default: "")
Comment 4 commit-hook freebsd_committer 2015-09-08 20:23:50 UTC
A commit references this bug:

Author: allanjude
Date: Tue Sep  8 20:22:52 UTC 2015
New revision: 287576
URL: https://svnweb.freebsd.org/changeset/base/287576

Log:
  service(8) -e does not respect /etc/rc.conf.d/* entries

  PR:		173454
  Submitted by:	giantlock@gmail.com (original patch)
  Approved by:	bapt (mentor)
  MFC after:	1 week
  Relnotes:	yes
  Sponsored by:	ScaleEngine Inc.
  Differential Revision:	https://reviews.freebsd.org/D3600

Changes:
  head/usr.sbin/service/service.sh
Comment 5 commit-hook freebsd_committer 2016-01-12 05:55:45 UTC
A commit references this bug:

Author: allanjude
Date: Tue Jan 12 05:55:28 UTC 2016
New revision: 293728
URL: https://svnweb.freebsd.org/changeset/base/293728

Log:
  MFC: r287576
    service(8) -e does not respect /etc/rc.conf.d/* entries

  PR:		173454
  Submitted by:	giantlock@gmail.com (original patch)

Changes:
_U  stable/10/
  stable/10/usr.sbin/service/service.sh