From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 12 23:07:48 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 661DF106566C; Tue, 12 Oct 2010 23:07:48 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mailoutltc.fnis.com (mailoutltc.fnis.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 2D8078FC16; Tue, 12 Oct 2010 23:07:47 +0000 (UTC) Received: from sbhfislrext02.fnfis.com ([192.168.249.140]) by SCSFISLTC01 (8.14.3/8.14.3) with ESMTP id o9CN7X9h002942; Tue, 12 Oct 2010 18:07:33 -0500 Received: from sbhfisltcgw01.FNFIS.COM (Not Verified[10.132.248.121]) by sbhfislrext02.fnfis.com with MailMarshal (v6, 5, 4, 7535) id ; Tue, 12 Oct 2010 18:07:28 -0500 Received: from SBHFISLTCGW04.FNFIS.COM ([10.132.248.123]) by sbhfisltcgw01.FNFIS.COM with Microsoft SMTPSVC(6.0.3790.4675); Tue, 12 Oct 2010 18:06:28 -0500 Received: from dt.vicor.com ([10.14.152.1]) by SBHFISLTCGW04.FNFIS.COM over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830); Tue, 12 Oct 2010 18:06:27 -0500 From: Devin Teske To: Doug Barton In-Reply-To: <4CB4B293.1050505@FreeBSD.org> References: <1286397912.27308.40.camel@localhost.localdomain> <4CB34BF9.4050504@FreeBSD.org> <1286824968.30494.46.camel@localhost.localdomain> <4CB4B293.1050505@FreeBSD.org> Content-Type: text/plain Date: Tue, 12 Oct 2010 16:06:25 -0700 Message-Id: <1286924785.32724.17.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-41.el4) Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 12 Oct 2010 23:06:27.0603 (UTC) FILETIME=[196BDE30:01CB6A62] Cc: freebsd-hackers@freebsd.org, Devin Teske Subject: Re: sysconf -- a sysctl(8)-like utility for managing /etc/rc.conf et. al. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 23:07:48 -0000 On Tue, 2010-10-12 at 12:10 -0700, Doug Barton wrote: > On 2010-10-11 at 10:40 -0700, Doug Barton wrote: > | So to summarize, the general idea is a good one and needed, and an area > | that I'd like to see more work in. Perhaps it might be a good idea to > | move the discussion about that to freebsd-rc@? > | > |On 2010-10-11 at 12:22 -0700, Devin Teske wrote: > |> I'll look into signing up for the rc mailing list (didn't see that when > |> I checked last -- I'll have to look again). Maybe I'll post v2.0 to > |> there (but will cc back hackers cause I know folks may not be part of > |> both). > > The canonical way to deal with that is to post the message to the proper > list (-rc@), then post a brief note to the other list (-hackers@) saying > where the discussion is being continued. We discourage people from > cc'ing multiple FreeBSD lists. This thread is moving over to the -rc@ list. New thread: sysrc(8) -- a sysctl(8)-like utility for managing rc.conf(5) The first post to the -rc@ list will be version 2.0 of the script which attempts to address the following (which were discussed in this thread here on -hackers@): 1. Style -- remove some personal styles in favor of standardized styles. (the FreeBSD environment doesn't need all the extra things that are required to run in an embedded environment -- which the first version was coded for) 2. Remove a disgusting-amount of comments (the first release of the script had a hurdle to climb in that it had to establish rapport with the targeted audience -- y'all). 3. Remove shell inheritance of SUCCESS/FAILURE (this was silly for a finished product). 4. Remove unnecessary code-sense (some things just don't need to be tested for in a known environment -- such as FreeBSD vs. embedded). 5. Remove dependency checks (have(), depend(), and show_deps() are gone). 6. Remove fake "function" keywords (public objections win) 7. Rename sysrc() function to sysrc_get() to: a. prevent confusion between the script and the internal function b. to coincide with the remainder of related functions (sysrc_get, sysrc_set, sysrc_find, and sysrc_desc). 8. Fix sysrc_get() function to mask positional parameters (don't expand "1", "2", etc.) 9. Fix sysrc_get() function to clean the environment prior to sourcing rc.conf(5) files (preventing expansion of normals such as PS1, TERM, etc.) 10. New function: `sysrc_find $varname' Find which file holds the effective last-assignment to a given variable within the rc.conf(5) file(s). If the variable is found in any of the rc.conf(5) files, the function prints the filename it was found in and then returns success. Otherwise output is NULL and the function returns with error status. 11. Fix sysrc_set() function to use mktemp(1) (prevent race-conditions where sysrc(8) could be executing in concurrence, possibly whacking the output-file in an unexpected manner). 12. New function: `sysrc_desc $varname' Attempts to return the comments associated with varname from the rc.conf (5) defaults file `/etc/defaults/rc.conf' (or whatever RC_DEFAULTS points to). Multi-line comments are joined together. Results are NULL if no description could be found. 13. Use getopts(1) to parse command-line options rather than manually parsing (now we can support grouping of flags -- i.e. "-avN"). 14. Remove `--help' option (using getopts(1) now ... that was the only long-option we had, and we don't need it). 15. Remove `-d' as we know it. No longer dump internal dependency list, but mimick `-d' from sysctl(8) -- Print a description of the given variable. 16. Remove `SYSRC_SHOW_DEPS' environment variable. 17. Add `SYSRC_VERBOSE' environment variable (inheritable from the shell, so that folks whom don't want to always pass `-v' can plop `SYSRC_VERBOSE=1' into their shell startup scripts, `~/.bash_profile' and `~/.profile' for example). 18. Add `-f file' option. Operate on the specified file(s) instead of rc_conf_files. 19. Add `-a' option. Dump a list of non-default configuration variables. 20. Add `-A' option. Dump a list of all configuration variables (incl. defaults). 21. Add `-v' option. Verbose. Print the pathname of the specific rc.conf(5) file where the directive was found. 22. Add `-i' option. Ignore unknown variables. 23. Add `-N' option. Show only variable names, not their values. And, here's the new usage: Usage: sysrc [OPTIONS] name[=value] ... OPTIONS: -h Print this message to stderr and exit. -f file Operate on the specified file(s) instead of rc_conf_files. -a Dump a list of non-default configuration variables. -A Dump a list of all configuration variables (incl. defaults). -d Print a description of the given variable. -e Print query results as `var=value' (useful for producing output to be fed back in). Ignored if -n is specified. -v Verbose. Print the pathname of the specific rc.conf(5) file where the directive was found. -i Ignore unknown variables. -n Show only variable values, not their names. -N Show only variable names, not their values. ENVIRONMENT: RC_DEFAULTS Location of `/etc/defaults/rc.conf' file. SYSRC_VERBOSE Default verbosity. Set to non-NULL to enable. See you all on the -rc@ list. -- Cheers, Devin Teske -> CONTACT INFORMATION <- Business Solutions Consultant II FIS - fisglobal.com 510-735-5650 Mobile 510-621-2038 Office 510-621-2020 Office Fax 909-477-4578 Home/Fax devin.teske@fisglobal.com -> LEGAL DISCLAIMER <- This message contains confidential and proprietary information of the sender, and is intended only for the person(s) to whom it is addressed. Any use, distribution, copying or disclosure by any other person is strictly prohibited. If you have received this message in error, please notify the e-mail sender immediately, and delete the original message without making a copy. -> FUN STUFF <- -----BEGIN GEEK CODE BLOCK----- Version 3.1 GAT/CS d(+) s: a- C++(++++) UB++++$ P++(++++) L++(++++) !E--- W++ N? o? K- w O M+ V- PS+ PE Y+ PGP- t(+) 5? X+(++) R>++ tv(+) b+(++) DI+(++) D(+) G+>++ e>+ h r>++ y+ ------END GEEK CODE BLOCK------ http://www.geekcode.com/ -> END TRANSMISSION <- _____________ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _____________