From owner-freebsd-doc@FreeBSD.ORG Thu Jan 24 20:32:31 2013 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D657A4DE for ; Thu, 24 Jan 2013 20:32:31 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-oa0-f53.google.com (mail-oa0-f53.google.com [209.85.219.53]) by mx1.freebsd.org (Postfix) with ESMTP id 76D2130E for ; Thu, 24 Jan 2013 20:32:31 +0000 (UTC) Received: by mail-oa0-f53.google.com with SMTP id l20so2673982oag.12 for ; Thu, 24 Jan 2013 12:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=ICqkKpaG1/6xgaKcx1TZNi378FJZTLsx6Cvua8YYvs4=; b=ZJovLHgpfiNrseP0tOqXfzYq6/55IdQTIe6Hb1Fpy/lskf9O6UoaVXtUww7y57KtpU iw5Al7TXPzFylKKTV6AZXa8UamV9D6FH/TMQgTo6S0+5/jWAsJcHSGCl1cw7RwUSU8yr KeyRE5qf8ULz3MZjXh/tSBOqrLsxLPAbvpIWnf6J3JeqYX8Tmuvuk/NT7BU9tlpn75hg 7bal/NmmXR0pmwgHZgegvp1RIvVDs1k1IAMoZWo+mebDpFAlZudaGE8JG+vbV4tLZ1ru B/OHQSsZ6lYlCm9NvYAm2ia5F3mAR3Wl0Q3B7jhTyXMUp2y65dVX++ygfJA5IV4qSk+A YxIw== X-Received: by 10.50.178.10 with SMTP id cu10mr2489535igc.75.1359059549314; Thu, 24 Jan 2013 12:32:29 -0800 (PST) MIME-Version: 1.0 Sender: utisoft@gmail.com Received: by 10.64.16.73 with HTTP; Thu, 24 Jan 2013 12:31:59 -0800 (PST) In-Reply-To: References: From: Chris Rees Date: Thu, 24 Jan 2013 20:31:59 +0000 X-Google-Sender-Auth: Pu99XD98P0YPYDzeVqwDQvHnyEQ Message-ID: Subject: Re: explicit use of /etc/rc.d vs service To: Warren Block Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-doc@freebsd.org X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2013 20:32:31 -0000 On 24 January 2013 20:13, Warren Block wrote: > On Thu, 24 Jan 2013, Eitan Adler wrote: > >> On 24 January 2013 10:36, Warren Block wrote: >>> >>> On Wed, 23 Jan 2013, Eitan Adler wrote: >>> >>>> Would anyone object to a patch which converts uses of >>>> "/etc/rc.d/daemon start" to "service daemon start" and the like? >>>> I would like to see service(1) become the standard interface to using >>>> services. >>> >>> >>> >>> Agreed. service(1) puts things in one place and abstracts them. Also, >>> it's >>> less typing and easier to autocomplete. > > > I did not look at this in detail, but would suggest that the unquoted > rc.conf examples should be quoted as the preferred form: > > >> --- a/en_US.ISO8859-1/books/handbook/config/chapter.xml >> +++ b/en_US.ISO8859-1/books/handbook/config/chapter.xml >> @@ -679,7 +679,7 @@ HOME=/var/log > > ... > >> It is easy to check if a service is enabled in >> /etc/rc.conf by running the appropriate >> @@ -720,7 +720,7 @@ HOME=/var/log >> sshd is in fact enabled in >> /etc/rc.conf by running: >> >> - &prompt.root; /etc/rc.d/sshd rcvar >> + &prompt.root; service sshd rcvar >> # sshd >> $sshd_enable=YES >> >> @@ -734,7 +734,7 @@ $sshd_enable=YES >> option is available. For instance to >> verify that sshd is actually started: > > > Should be sshd_enable="YES" in both places. Why? Useless quotes are not useful, and the habit of using them everywhere is actively harmful. For example, our make is perfectly happy with: .if ${ARCH} == "amd64" and .if ${ARCH} == amd64 even though the former is actually incorrect. However, if an unsuspecting person does the same in GNU Make, ifeq ($(ARCH),"amd64") they are in for a shock, and spend a while wondering why it doesn't work [1]. Also, have a look in rc.subr; [crees@pegasus]~% grep '="[^[:space:]]*$' /etc/rc.subr | wc -l # Uselessly quoted 36 [crees@pegasus]~% grep '=[^"[:space:]]*$' /etc/rc.subr | wc -l # Not quoted 114 Of the 36 lines that are apparently uselessly quoted, 16 contain variables, so that's OK; [crees@pegasus]~% grep '="[^[:space:]]*\$[^[:space:]]*$' /etc/rc.subr | wc -l 16 and finally, show all the lines that are truly uselessly quoted: [crees@pegasus]~% grep '="[^\$|&;<>()`[:space:]]*$' /etc/rc.subr | wc -l 13 Sorry to sound a little OCD, but overquoting bothers me, and it doesn't fit with rc.subr style. (Let's ignore defaults/rc.conf for now...) Chris [1] http://www.bayofrum.net/~crees/scratch/gmake-quotes.mk