Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jan 2013 20:31:59 +0000
From:      Chris Rees <crees@FreeBSD.org>
To:        Warren Block <wblock@wonkity.com>
Cc:        freebsd-doc@freebsd.org
Subject:   Re: explicit use of /etc/rc.d vs service
Message-ID:  <CADLo83_F0V7NUjQNRHzrALqtQL2thpYb_rFq%2BE-vLt=AK%2BRJQQ@mail.gmail.com>
In-Reply-To: <alpine.BSF.2.00.1301241308520.84905@wonkity.com>
References:  <CAF6rxgnJPFevO7W%2BypBZdcL7deB%2B_cQHF0AEcVaWWv8FFhcNcQ@mail.gmail.com> <alpine.BSF.2.00.1301240835180.82165@wonkity.com> <CAF6rxgnCEc_7tO9QzMPuEuMr1cOBXO-_BU8oouG3J-Jv7MkeqQ@mail.gmail.com> <alpine.BSF.2.00.1301241308520.84905@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 24 January 2013 20:13, Warren Block <wblock@wonkity.com> wrote:
> On Thu, 24 Jan 2013, Eitan Adler wrote:
>
>> On 24 January 2013 10:36, Warren Block <wblock@wonkity.com> 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
>
> ...
>
>>     <para>It is easy to check if a service is enabled in
>>       <filename>/etc/rc.conf</filename> by running the appropriate
>> @@ -720,7 +720,7 @@ HOME=/var/log
>>       <command>sshd</command> is in fact enabled in
>>       <filename>/etc/rc.conf</filename> by running:</para>
>>
>> -    <screen>&prompt.root; <userinput>/etc/rc.d/sshd rcvar</userinput>
>> +    <screen>&prompt.root; <userinput>service sshd rcvar</userinput>
>> # sshd
>> $sshd_enable=YES</screen>
>>
>> @@ -734,7 +734,7 @@ $sshd_enable=YES</screen>
>>       <option>status</option> option is available.  For instance to
>>       verify that <command>sshd</command> is actually started:</para>
>
>
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADLo83_F0V7NUjQNRHzrALqtQL2thpYb_rFq%2BE-vLt=AK%2BRJQQ>