Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Dec 2012 14:10:20 -0800
From:      Garrett Cooper <yanegomi@gmail.com>
To:        Hiroki Sato <hrs@freebsd.org>
Cc:        rc@freebsd.org, current@freebsd.org
Subject:   Re: RFC: sysctl -f filename
Message-ID:  <CAGH67wTC50X1M2uUo0g=Nm6PmpOXPzYnp4tbXDCQyA9eOKB%2B7Q@mail.gmail.com>
In-Reply-To: <20121202.015048.1122480556487090170.hrs@allbsd.org>
References:  <20121202.015048.1122480556487090170.hrs@allbsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Dec 1, 2012 at 8:50 AM, Hiroki Sato <hrs@freebsd.org> wrote:
> Hi,
>
>  I would like comments about the attached patch for sysctl(8) to add a
>  new option "-f filename".  It supports reading of a file with
>  key=value lines.
>
>  As you probably know, we already have /etc/sysctl.conf and it is
>  processed by rc.d/sysctl shell script in a line-by-line basis.  The
>  problem I want to fix is a confusing syntax of /etc/sysctl.conf.  The
>  file supports a typical configuration file syntax but problematic in
>  some cases.  For example:
>
>   kern.coredump=1
>
>  works well in /etc/sysctl.conf, but
>
>   kern.coredump="1"
>
>  does not work.  Similarly, it is difficult to use whitespaces and "#"
>  in the value:
>
>   OK: kern.domainname=domain\ name\ with\ spaces
>   NG: kern.domainname="domain name with spaces"
>   NG: kern.domainname=domain\ name\ including\ #\ character
>   NG: kern.domainname=domain\ name\ including\ \#\ character
>
>  The attached patch solves them, and in addition it displays an error
>  message with a line number if there is something wrong in the file
>  like this:
>
>   % cat -n /etc/sysctl.conf
>   ...
>   10  kern.coredump=1
>   11  kern.coredump2=1
>   ...
>
>   % /etc/rc.d/sysctl start
>   sysctl: kern.coredump at line 10: Operation not permitted
>   sysctl: unknown oid 'kern.coredump2' at line 11
>
>   # /etc/rc.d/sysctl start
>   kern.coredump: 1 -> 1
>   sysctl: unknown oid 'kern.coredump2' at line 11
>
>  Any comments are welcome.

    Why change the tool when we can change the rc script to do the
right thing? I have a patch I'm working on to resolve this (you hit an
itch I've been meaning to scratch for a little while).
Thanks!
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wTC50X1M2uUo0g=Nm6PmpOXPzYnp4tbXDCQyA9eOKB%2B7Q>