From owner-freebsd-rc@FreeBSD.ORG Sun Mar 4 06:35:31 2007 Return-Path: X-Original-To: freebsd-rc@freebsd.org Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3FEF716A401 for ; Sun, 4 Mar 2007 06:35:31 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx24.fluidhosting.com [204.14.89.7]) by mx1.freebsd.org (Postfix) with SMTP id D39B613C428 for ; Sun, 4 Mar 2007 06:35:30 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: (qmail 22903 invoked by uid 399); 4 Mar 2007 06:35:29 -0000 Received: from localhost (HELO lap.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with SMTP; 4 Mar 2007 06:35:29 -0000 X-Originating-IP: 127.0.0.1 Message-ID: <45EA68AF.6000700@FreeBSD.org> Date: Sat, 03 Mar 2007 22:35:27 -0800 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0b2 (X11/20070116) MIME-Version: 1.0 To: Yar Tikhiy , freebsd-rc@freebsd.org References: <200703031011.l23ABYhb039755@repoman.freebsd.org> In-Reply-To: <200703031011.l23ABYhb039755@repoman.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: cvs commit: doc/en_US.ISO8859-1/articles/rc-scripting article.sgml X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 04 Mar 2007 06:35:31 -0000 Yar Tikhiy wrote: > yar 2007-03-03 10:11:34 UTC > > FreeBSD doc repository > > Modified files: > en_US.ISO8859-1/articles/rc-scripting article.sgml > Log: > Explain how an rc.d script can use extra command-line arguments. > > Revision Changes Path > 1.9 +138 -0 doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml > > http://www.FreeBSD.org/cgi/cvsweb.cgi/doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml.diff?&r1=1.8&r2=1.9&f=h Yar, This good stuff, thanks! I have one quibble with the last paragraph. The shift in rc.subr isn't "apparent" as you phrase it, it's literal: run_rc_command() { ... # Don't repeat the first argument when passing additional command- # line arguments to the command subroutines. # shift 1 rc_extra_args="$*" ... I would also put this information in the second paragraph, since as a first time reader of your piece I had the question very early on. I would say: limits). The first command line parameter (start|stop|etc.) will be shifted out by rc.subr, so what was $2 on the original command line will become $1, and so on. Therefore the changes in the script itself ... hth, Doug -- This .signature sanitized for your protection From owner-freebsd-rc@FreeBSD.ORG Sun Mar 4 13:04:12 2007 Return-Path: X-Original-To: freebsd-rc@FreeBSD.org Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D947116A404; Sun, 4 Mar 2007 13:04:12 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.freebsd.org (Postfix) with ESMTP id DE70B13C461; Sun, 4 Mar 2007 13:04:11 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.4) with ESMTP id l24D48VS050700; Sun, 4 Mar 2007 16:04:08 +0300 (MSK) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.4/Submit) id l24D48lH050699; Sun, 4 Mar 2007 16:04:08 +0300 (MSK) (envelope-from yar) Date: Sun, 4 Mar 2007 16:04:08 +0300 From: Yar Tikhiy To: Doug Barton Message-ID: <20070304130408.GJ40430@comp.chem.msu.su> References: <200703031011.l23ABYhb039755@repoman.freebsd.org> <45EA68AF.6000700@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45EA68AF.6000700@FreeBSD.org> User-Agent: Mutt/1.5.9i Cc: freebsd-rc@FreeBSD.org Subject: Re: cvs commit: doc/en_US.ISO8859-1/articles/rc-scripting article.sgml X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 04 Mar 2007 13:04:13 -0000 On Sat, Mar 03, 2007 at 10:35:27PM -0800, Doug Barton wrote: > Yar Tikhiy wrote: > >yar 2007-03-03 10:11:34 UTC > > > > FreeBSD doc repository > > > > Modified files: > > en_US.ISO8859-1/articles/rc-scripting article.sgml > > Log: > > Explain how an rc.d script can use extra command-line arguments. > > > > Revision Changes Path > > 1.9 +138 -0 > > doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml > > > >http://www.FreeBSD.org/cgi/cvsweb.cgi/doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml.diff?&r1=1.8&r2=1.9&f=h > > Yar, > > This good stuff, thanks! I have one quibble with the last paragraph. > The shift in rc.subr isn't "apparent" as you phrase it, it's literal: Yeah, I tried to hide a thing from the reader which he should already have known: the shift command. :-) > run_rc_command() > { > ... > # Don't repeat the first argument when passing additional command- > # line arguments to the command subroutines. > # > shift 1 > rc_extra_args="$*" Oh my... Now I see why existing rc.d scripts use this bogus command: run_rc_command "$*" It's because rc.subr will mess up the arguments anyway. Perhaps we should investigate if "$@" can be used consistently to preserve original boundaries between arguments to an rc.d script... Now we have little chance there as the final command is eval, which is the ultimate killer of the original boundaries. I'm uncertain if the eval is really necessary to invoke rc.d methods. > ... > > I would also put this information in the second paragraph, since as a > first time reader of your piece I had the question very early on. I > would say: > > limits). The first command line parameter (start|stop|etc.) will be > shifted out by rc.subr, so what was $2 on the original command line > will become $1, and so on. Therefore the changes in the script itself ... Thank you for this suggestion, it sounds very reasonable! -- Yar From owner-freebsd-rc@FreeBSD.ORG Sun Mar 4 13:54:47 2007 Return-Path: X-Original-To: freebsd-rc@FreeBSD.org Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5ED3C16A400; Sun, 4 Mar 2007 13:54:47 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.freebsd.org (Postfix) with ESMTP id 96F6413C474; Sun, 4 Mar 2007 13:54:46 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.4) with ESMTP id l24DsibR051346; Sun, 4 Mar 2007 16:54:44 +0300 (MSK) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.4/Submit) id l24Dsi67051341; Sun, 4 Mar 2007 16:54:44 +0300 (MSK) (envelope-from yar) Date: Sun, 4 Mar 2007 16:54:43 +0300 From: Yar Tikhiy To: Doug Barton Message-ID: <20070304135443.GK40430@comp.chem.msu.su> References: <200703031011.l23ABYhb039755@repoman.freebsd.org> <45EA68AF.6000700@FreeBSD.org> <20070304130408.GJ40430@comp.chem.msu.su> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070304130408.GJ40430@comp.chem.msu.su> User-Agent: Mutt/1.5.9i Cc: freebsd-rc@FreeBSD.org Subject: Re: cvs commit: doc/en_US.ISO8859-1/articles/rc-scripting article.sgml X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 04 Mar 2007 13:54:47 -0000 On Sun, Mar 04, 2007 at 04:04:08PM +0300, Yar Tikhiy wrote: > On Sat, Mar 03, 2007 at 10:35:27PM -0800, Doug Barton wrote: > > Yar Tikhiy wrote: > > >yar 2007-03-03 10:11:34 UTC > > > > > > FreeBSD doc repository > > > > > > Modified files: > > > en_US.ISO8859-1/articles/rc-scripting article.sgml > > > Log: > > > Explain how an rc.d script can use extra command-line arguments. > > > > > > Revision Changes Path > > > 1.9 +138 -0 > > > doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml > > > > > >http://www.FreeBSD.org/cgi/cvsweb.cgi/doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml.diff?&r1=1.8&r2=1.9&f=h > > > > Yar, > > > > This good stuff, thanks! I have one quibble with the last paragraph. > > The shift in rc.subr isn't "apparent" as you phrase it, it's literal: > > Yeah, I tried to hide a thing from the reader which he should already > have known: the shift command. :-) > > > run_rc_command() > > { > > ... > > # Don't repeat the first argument when passing additional command- > > # line arguments to the command subroutines. > > # > > shift 1 > > rc_extra_args="$*" > > Oh my... Now I see why existing rc.d scripts use this bogus command: > > run_rc_command "$*" > > It's because rc.subr will mess up the arguments anyway. Perhaps > we should investigate if "$@" can be used consistently to preserve > original boundaries between arguments to an rc.d script... Now we > have little chance there as the final command is eval, which is the > ultimate killer of the original boundaries. I'm uncertain if the > eval is really necessary to invoke rc.d methods. I failed to take into account initially that $foo_cmd can be a random shell expression, not only a function name. That's why we need the final eval. OTOH, letting extra arguments is usually wrong if $foo_cmd isn't a function name. E.g., let's consider the following bones of a script: name=foo start_cmd="echo Hello world; exit 0" run_rc_command "$@" If we issue ``foo start 1 2 3'', the ultimate shell command executed will be ``echo Hello world; exit 0 1 2 3'', which is bogus... Nevertheless we seem to be doomed to mishandle rc.d arguments with embedded whitespace. Sigh. -- Yar From owner-freebsd-rc@FreeBSD.ORG Sun Mar 4 22:52:52 2007 Return-Path: X-Original-To: freebsd-rc@FreeBSD.org Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6824D16A403 for ; Sun, 4 Mar 2007 22:52:52 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx24.fluidhosting.com [204.14.89.7]) by mx1.freebsd.org (Postfix) with SMTP id 1E50613C47E for ; Sun, 4 Mar 2007 22:52:51 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: (qmail 2101 invoked by uid 399); 4 Mar 2007 22:52:51 -0000 Received: from localhost (HELO lap.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with SMTP; 4 Mar 2007 22:52:51 -0000 X-Originating-IP: 127.0.0.1 Message-ID: <45EB4DC1.6040903@FreeBSD.org> Date: Sun, 04 Mar 2007 14:52:49 -0800 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0b2 (X11/20070116) MIME-Version: 1.0 To: Yar Tikhiy References: <200703031011.l23ABYhb039755@repoman.freebsd.org> <45EA68AF.6000700@FreeBSD.org> <20070304130408.GJ40430@comp.chem.msu.su> In-Reply-To: <20070304130408.GJ40430@comp.chem.msu.su> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-rc@FreeBSD.org Subject: Re: cvs commit: doc/en_US.ISO8859-1/articles/rc-scripting article.sgml X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 04 Mar 2007 22:52:52 -0000 Yar Tikhiy wrote: > On Sat, Mar 03, 2007 at 10:35:27PM -0800, Doug Barton wrote: >> Yar Tikhiy wrote: >>> yar 2007-03-03 10:11:34 UTC >>> >>> FreeBSD doc repository >>> >>> Modified files: >>> en_US.ISO8859-1/articles/rc-scripting article.sgml >>> Log: >>> Explain how an rc.d script can use extra command-line arguments. >>> >>> Revision Changes Path >>> 1.9 +138 -0 >>> doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml >>> >>> http://www.FreeBSD.org/cgi/cvsweb.cgi/doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml.diff?&r1=1.8&r2=1.9&f=h >> Yar, >> >> This good stuff, thanks! I have one quibble with the last paragraph. >> The shift in rc.subr isn't "apparent" as you phrase it, it's literal: > > Yeah, I tried to hide a thing from the reader which he should already > have known: the shift command. :-) Again, looking at it from the point of view of a naive reader, there is a difference between "I know that the shift command exists, and sort of know what it does" and "I know how the shift command is used by rc.subr to affect the command line arguments to my script." Your article is (to some extent) about teaching the latter, so I think it's reasonable to spend some time spoon feeding the reader until they are ready for some meat. >> run_rc_command() >> { >> ... >> # Don't repeat the first argument when passing additional command- >> # line arguments to the command subroutines. >> # >> shift 1 >> rc_extra_args="$*" > > Oh my... Now I see why existing rc.d scripts use this bogus command: > > run_rc_command "$*" > > It's because rc.subr will mess up the arguments anyway. I think it's more likely that someone would use $* vs. $@ out of force of habit. :) > Perhaps > we should investigate if "$@" can be used consistently to preserve > original boundaries between arguments to an rc.d script... I wouldn't object to some testing on that. I'll change my local copy and see how it behaves. ... > Thank you for this suggestion, it sounds very reasonable! Glad to help, as always. Regards, Doug -- This .signature sanitized for your protection From owner-freebsd-rc@FreeBSD.ORG Mon Mar 5 11:08:22 2007 Return-Path: X-Original-To: freebsd-rc@FreeBSD.org Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AA63616A402 for ; Mon, 5 Mar 2007 11:08:22 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 9438113C4B7 for ; Mon, 5 Mar 2007 11:08:22 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (linimon@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l25B8MWx037587 for ; Mon, 5 Mar 2007 11:08:22 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from linimon@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l25B8LkY037583 for freebsd-rc@FreeBSD.org; Mon, 5 Mar 2007 11:08:21 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 5 Mar 2007 11:08:21 GMT Message-Id: <200703051108.l25B8LkY037583@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: linimon set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-rc@FreeBSD.org Cc: Subject: Current problem reports assigned to you X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 05 Mar 2007 11:08:22 -0000 Current FreeBSD problem reports Critical problems Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- o conf/48881 rc [PATCH] The influence of /etc/start_ifname on /etc/rc. o conf/98758 rc [patch] Templatize 'jail_fstab' in /etc/rc.d/jail o conf/98846 rc [patch] Templatize 'jail_rootdir' in /etc/rc.d/jail o bin/104623 rc "rc.d/ppp restart" stops all instances of ppp o conf/105689 rc syslogd starts too late at boot o conf/107155 rc /etc/rc.d/ppp-user does not bring up pppoe at boot o conf/107316 rc [rc.d]: [base] [rpc.lockd] nfslocking restart does not o conf/107364 rc pf fails to start on bootup after system update from F o conf/108226 rc second copy of ppp started at boot time 9 problems total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- o conf/45226 rc Fix for rc.network, ppp-user annoyance o conf/48870 rc [PATCH] rc.network: allow to cancel interface status d o conf/55916 rc [PATCH] ppp-user options o conf/58939 rc [patch] dumb little hack for /etc/rc.firewall{,6} o conf/73677 rc [patch] add support for powernow states to power_profi o conf/74817 rc [patch] network.subr: fixed automatic configuration of o conf/77663 rc Suggestion: add /etc/rc.d/addnetswap after addcritremo o conf/78906 rc [patch] Allow mixer_enable="NO" in rc.conf o conf/79196 rc [PATCH] configurable dummynet loading from /etc/rc.co o kern/81006 rc ipnat not working with tunnel interfaces on startup o conf/85363 rc syntax error in /etc/rc.d/devfs o conf/85819 rc [patch] script allowing multiuser mode in spite of fsc o conf/88913 rc [patch] wrapper support for rc.subr o conf/89061 rc [patch] IPv6 6to4 auto-configuration enhancement o conf/89870 rc [patch] feature request to make netif verbose rc.conf o conf/92523 rc [patch] allow rc scripts to kill process after a timeo o conf/93815 rc [patch] Adds in the ability to save ipfw rules to rc.d o conf/95162 rc [patch] Missing feature in rc.subr o conf/96343 rc [patch] rc.d order change to start inet6 before pf o conf/99444 rc [patch] Enhancement: rc.subr could easily support star o conf/99595 rc [PATCH] /etc/rc.d/dhclient doesn't interact well with o conf/99721 rc [patch] /etc/rc.initdiskless problem copy dotfile in s o conf/102700 rc [PATCH] Add encrypted /tmp support to GELI/GBDE rc.d s o conf/102722 rc kerberos5 server startupscript should use --detach o conf/102913 rc /etc/rc.d/named killall in jailed OS o conf/103486 rc [rc.d][patch][chroot named] rc.d/jail: mount fstab aft o conf/103489 rc [rc.d] [patch] named_chroot_autoupdate doesn't work in o conf/103976 rc rc.d/named restart failure o conf/104408 rc command not set in rc.d/isdnd, can't stop isdnd with t o conf/104549 rc [patch] rc.d/nfsd needs special _find_processes functi o conf/105145 rc [PATCH] add redial function to rc.d/ppp o conf/105568 rc [patch] Add more flexibility to rc.conf, to choose "_e o conf/106009 rc [patch] Fix pppoed startup script to process multiply o conf/106873 rc [patch] rc.d/nfslocking does not properly restart 34 problems total. From owner-freebsd-rc@FreeBSD.ORG Mon Mar 5 19:31:28 2007 Return-Path: X-Original-To: freebsd-rc@FreeBSD.org Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DCFCE16A406; Mon, 5 Mar 2007 19:31:28 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.freebsd.org (Postfix) with ESMTP id 1A27513C4A8; Mon, 5 Mar 2007 19:31:27 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.4) with ESMTP id l25JVPIT072352; Mon, 5 Mar 2007 22:31:26 +0300 (MSK) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.4/Submit) id l25JVPXR072351; Mon, 5 Mar 2007 22:31:25 +0300 (MSK) (envelope-from yar) Date: Mon, 5 Mar 2007 22:31:25 +0300 From: Yar Tikhiy To: Doug Barton Message-ID: <20070305193125.GG57253@comp.chem.msu.su> References: <200703031011.l23ABYhb039755@repoman.freebsd.org> <45EA68AF.6000700@FreeBSD.org> <20070304130408.GJ40430@comp.chem.msu.su> <45EB4DC1.6040903@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45EB4DC1.6040903@FreeBSD.org> User-Agent: Mutt/1.5.9i Cc: freebsd-rc@FreeBSD.org Subject: Re: cvs commit: doc/en_US.ISO8859-1/articles/rc-scripting article.sgml X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 05 Mar 2007 19:31:29 -0000 On Sun, Mar 04, 2007 at 02:52:49PM -0800, Doug Barton wrote: > Yar Tikhiy wrote: > >On Sat, Mar 03, 2007 at 10:35:27PM -0800, Doug Barton wrote: > >>Yar Tikhiy wrote: > >>>yar 2007-03-03 10:11:34 UTC > >>> > >>> FreeBSD doc repository > >>> > >>> Modified files: > >>> en_US.ISO8859-1/articles/rc-scripting article.sgml > >>> Log: > >>> Explain how an rc.d script can use extra command-line arguments. > >>> > >>> Revision Changes Path > >>> 1.9 +138 -0 > >>> doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml > >>> > >>>http://www.FreeBSD.org/cgi/cvsweb.cgi/doc/en_US.ISO8859-1/articles/rc-scripting/article.sgml.diff?&r1=1.8&r2=1.9&f=h > >>Yar, > >> > >>This good stuff, thanks! I have one quibble with the last paragraph. > >>The shift in rc.subr isn't "apparent" as you phrase it, it's literal: > > > >Yeah, I tried to hide a thing from the reader which he should already > >have known: the shift command. :-) > > Again, looking at it from the point of view of a naive reader, there > is a difference between "I know that the shift command exists, and > sort of know what it does" and "I know how the shift command is used > by rc.subr to affect the command line arguments to my script." Your > article is (to some extent) about teaching the latter, so I think it's > reasonable to spend some time spoon feeding the reader until they are > ready for some meat. Agreed! The new revision tries to do that better. > >>run_rc_command() > >>{ > >> ... > >> # Don't repeat the first argument when passing additional command- > >> # line arguments to the command subroutines. > >> # > >> shift 1 > >> rc_extra_args="$*" > > > >Oh my... Now I see why existing rc.d scripts use this bogus command: > > > > run_rc_command "$*" > > > >It's because rc.subr will mess up the arguments anyway. > > I think it's more likely that someone would use $* vs. $@ out of force > of habit. :) It's a bad habit IMHO unless one really means $* :-) > >Perhaps > >we should investigate if "$@" can be used consistently to preserve > >original boundaries between arguments to an rc.d script... > > I wouldn't object to some testing on that. I'll change my local copy > and see how it behaves. I took a look at that and found that, as long as we support for random shell expressions in $foo_cmd, the magic wand of "$@" cannot help us without some additional black magic. If $foo_cmd were guaranteed to be merely the name of a function or simple command, then we would need no final eval to execute $foo_cmd. But stuffing shell expressions in $foo_cmd is neat and should be supported. Perhaps we should just tell people that they cannot pass hairy arguments to rc.d scripts -- each argument must be a simple word. -- Yar From owner-freebsd-rc@FreeBSD.ORG Mon Mar 5 22:44:08 2007 Return-Path: X-Original-To: freebsd-rc@freebsd.org Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4A89216A400 for ; Mon, 5 Mar 2007 22:44:08 +0000 (UTC) (envelope-from fbsdmail@dnswatch.com) Received: from fast.dnswatch.com (fast.dnswatch.com [216.177.243.43]) by mx1.freebsd.org (Postfix) with ESMTP id CB59113C4A3 for ; Mon, 5 Mar 2007 22:44:07 +0000 (UTC) (envelope-from fbsdmail@dnswatch.com) Received: from fast.dnswatch.com (localhost.dnswatch.com [127.0.0.1]) by fast.dnswatch.com (8.13.6/8.13.6) with ESMTP id l25M8UQR014352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 5 Mar 2007 14:08:39 -0800 (PST) (envelope-from fbsdmail@dnswatch.com) Received: (from somebody@localhost) by fast.dnswatch.com (8.13.6/8.13.6/Submit) id l25M8T6E014351 for freebsd-rc@freebsd.org; Mon, 5 Mar 2007 14:08:29 -0800 (PST) (envelope-from fbsdmail@dnswatch.com) Received: from secure.1command.com (secure.1command.com [216.177.243.34]) by webmail.dnswatch.com (Horde MIME library) with HTTP; Mon, 05 Mar 2007 14:08:27 -0800 Message-ID: <20070305140827.i63kbnlq0w4s0cgk@webmail.dnswatch.com> X-Priority: 3 (Normal) Date: Mon, 05 Mar 2007 14:08:27 -0800 From: Chris To: freebsd-rc@freebsd.org References: <45B36737.6080208@FreeBSD.org> <45B3A899.2060207@FreeBSD.org> <45CBBE8A.4030901@FreeBSD.org> In-Reply-To: <45CBBE8A.4030901@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_1lx4feiw6h8g" Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.1.3) / FreeBSD-5.5 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: Service-specific default locales X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 05 Mar 2007 22:44:08 -0000 This message is in MIME format. --=_1lx4feiw6h8g Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Quoting Florent Thoumie : > Florent Thoumie wrote: >> Florent Thoumie wrote: >>> Andrew Pantyukhin wrote: >>>> I need to run different services in different locales >>>> (basically LANG/LC_ALL changed). Before I look at how >>>> to implement it, is there any objection to >>>> _locale presetting the two variables to its >>>> value (and possibly some error-checking via locale(1)? >>>> >>>> As for a site-wide default, I currently have "export >>>> LANG=3Den_US.UTF-8" in my rc.conf. Should we introduce >>>> a general "locale" variable for this? >>> Makes sense to me. Have a look at *_nice variable for example. >> >> Thinking about it, maybe something like _env would be better >> (cause more generic). Of course you wouldn't be able to do error >> checking but I'm not sure it's so useful anyway. > > Any update on that, do you need help or something? Greetings, While I cannot speak for the original poster, I have a related problem; When I run a web based MAN query, MAN vomits the following to my web log: ctype locale: Invalid argument I've spent hours searching the mail archives, read the MAN pages, and searched Google/ Yahoo!. Yet no joy. I found a short bit in the mail archives. But the suggestions didn't seem to help. I don't recieve this error at the console while typing MAN , but that does not mean that MAN is not unhappy. Any and all suggestions /greatly/ appreciated. Thank you for all your time and consideration. --Chris > > -- > Florent Thoumie > flz@FreeBSD.org > FreeBSD Committer > > ---------------------------------------------------------------- H.R. Communications Internet messaging service. Please report any abuse of this system to postmaster, or better, abuse at the domain of the offending sender. --=_1lx4feiw6h8g--