From owner-freebsd-rc@FreeBSD.ORG Sat Dec 1 22:10:22 2012 Return-Path: Delivered-To: rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F3543ED0; Sat, 1 Dec 2012 22:10:21 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by mx1.freebsd.org (Postfix) with ESMTP id 961928FC0C; Sat, 1 Dec 2012 22:10:21 +0000 (UTC) Received: by mail-oa0-f54.google.com with SMTP id n9so2099963oag.13 for ; Sat, 01 Dec 2012 14:10:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=JldwXiYEvlndzPi1Qr8krwwoP7ZCVpuMuxei7RmMbV8=; b=prVeIBoV96ffzPPgSxsw9FUNyud7KFH3HSOSg0pnXPUxk3RUUTRDbCdzkZqjLInU8A 646uRW/9RthmjX/aqGZ7RMXJs5+4OdmEIZCM0Oz2OK6VsVxj0oVbA4YQJKwPAMC7gZKh 6dCdcRbzXIskfkD/ojCIlCk5I9rPu+LtkvTTmPSu4tzTufCo7jEJqsgRUQmj12lJwIZg 7lp4/ggjIUg9ZbASygn8a8DjMq4OT0xxv2q+NwNLZrARdXOqR+upDcShOz0eQn9wHiCm o8tv5wVmSmYBDdhDXtbF7RbW5+GShlcty6lUM6/Cleb/v0aphv6R/NIv867+9DREbUfZ QVQg== MIME-Version: 1.0 Received: by 10.60.10.133 with SMTP id i5mr4608090oeb.24.1354399820833; Sat, 01 Dec 2012 14:10:20 -0800 (PST) Received: by 10.76.143.33 with HTTP; Sat, 1 Dec 2012 14:10:20 -0800 (PST) In-Reply-To: <20121202.015048.1122480556487090170.hrs@allbsd.org> References: <20121202.015048.1122480556487090170.hrs@allbsd.org> Date: Sat, 1 Dec 2012 14:10:20 -0800 Message-ID: Subject: Re: RFC: sysctl -f filename From: Garrett Cooper To: Hiroki Sato Content-Type: text/plain; charset=ISO-8859-1 Cc: rc@freebsd.org, current@freebsd.org X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2012 22:10:22 -0000 On Sat, Dec 1, 2012 at 8:50 AM, 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. 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