From owner-freebsd-current@FreeBSD.ORG Sat Dec 1 23:44:25 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4F153F0; Sat, 1 Dec 2012 23:44:25 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from duck.symmetricom.us (duck.symmetricom.us [206.168.13.214]) by mx1.freebsd.org (Postfix) with ESMTP id 7235B8FC12; Sat, 1 Dec 2012 23:44:25 +0000 (UTC) Received: from damnhippie.dyndns.org (daffy.symmetricom.us [206.168.13.218]) by duck.symmetricom.us (8.14.5/8.14.5) with ESMTP id qB1NiOXe000763; Sat, 1 Dec 2012 16:44:25 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id qB1Ni2l6044024; Sat, 1 Dec 2012 16:44:02 -0700 (MST) (envelope-from freebsd@damnhippie.dyndns.org) Subject: Re: RFC: sysctl -f filename From: Ian Lepore To: Hiroki Sato In-Reply-To: <20121202.015048.1122480556487090170.hrs@allbsd.org> References: <20121202.015048.1122480556487090170.hrs@allbsd.org> Content-Type: text/plain; charset="us-ascii" Date: Sat, 01 Dec 2012 16:44:02 -0700 Message-ID: <1354405442.69940.586.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 23:44:25 -0000 On Sun, 2012-12-02 at 01:50 +0900, Hiroki Sato 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. > > -- Hiroki This is cool, thanks. Shouldn't there be an update to sysctl.conf(5) to mention the ability to handle quoting now? -- Ian