From owner-freebsd-rc@FreeBSD.ORG Sun Jun 12 03:54:27 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 712DD1065670; Sun, 12 Jun 2011 03:54:27 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from no.spam.no.ddos.ru (no.spam.no.ddos.ru [IPv6:2a02:978:2:1000::3]) by mx1.freebsd.org (Postfix) with ESMTP id EFD3A8FC12; Sun, 12 Jun 2011 03:54:26 +0000 (UTC) Received: from ws.su29.net (v6.mpls.in [IPv6:2a02:978:2::5]) by no.spam.no.ddos.ru (Postfix) with ESMTPA id 76CFE362A32; Sun, 12 Jun 2011 07:52:51 +0400 (MSD) Message-ID: <4DF43813.5020508@ipfw.ru> Date: Sun, 12 Jun 2011 07:52:51 +0400 From: "Alexander V. Chernikov" User-Agent: Thunderbird 2.0.0.24 (X11/20100515) MIME-Version: 1.0 To: Hiroki Sato References: <20110612.055610.725598761140735688.hrs@allbsd.org> In-Reply-To: <20110612.055610.725598761140735688.hrs@allbsd.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: dougb@FreeBSD.org, pluknet@gmail.com, freebsd-rc@FreeBSD.org Subject: Re: [CFR] rc.conf interface description 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, 12 Jun 2011 03:54:27 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hiroki Sato wrote: > Sergey Kandaurov wrote > in : > > pl> Hello. > pl> > pl> Some time ago there was a discussion about ifconfig descr integration > pl> into rc. That means you can store interface descriptions in rc.conf file, > pl> so that the descriptions survive between system reboots. To achieve it, > pl> you need to place one-line option into rc.conf, e.g. like this: > pl> ifconfig_em0_descr="Uplink to Gigabit Switch 1", or > pl> ifconfig_vlan8_descr="description '1 2 3' vlan 255 vlandev IFACE" > pl> > pl> so after reboot or manual `rc.d/netif restart $iface` invocation, you''ll see > pl> something like this: > pl> vlan8: flags=8843 metric 0 mtu 1500 > pl> description: description '1 2 3' vlan 255 vlandev IFACE > pl> [...] > pl> And rc.d/netif stop $iface removes description from a network interface. > pl> > pl> You can see the previous discussion in -current@ and -rc@ mail archives: > pl> http://www.mail-archive.com/freebsd-current@freebsd.org/msg124513.html > pl> However, that time it went nowhere due to luck of time/interest. > pl> > pl> Recently I learned that this patch is actually used. > pl> I was requested to integrate it into the head. > pl> I'd like to collect your opinions/objections/thoughts to ensure whether > pl> there are might be issues preventing from committing it. > > I have no strong objection but I am still wondering if we really need > to have the dedicated variable for ifconfig descr. Is simply > specifying ifconfig_IF="descr FOO" not enough? Unfortunately it is not. You can't (easily) set interface description like 'FOO BAR' via ifconfig_IF. Please see conf/156675 for a bit longer desciption. > > -- Hiroki -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk30OBMACgkQwcJ4iSZ1q2lY0ACfbnCI1gV2PZVVujFB0pH7w+S+ 0jMAoKNEWxWnI8qdrB0ASIiA7DgRbFKY =R7Ok -----END PGP SIGNATURE----- From owner-freebsd-rc@FreeBSD.ORG Sun Jun 12 05:45:43 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2220C106564A; Sun, 12 Jun 2011 05:45:43 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.vlsi.ee.noda.tus.ac.jp (sekine00.ee.noda.sut.ac.jp [133.31.107.40]) by mx1.freebsd.org (Postfix) with ESMTP id D06818FC08; Sun, 12 Jun 2011 05:45:42 +0000 (UTC) Received: from alph.allbsd.org (p2237-ipbf904funabasi.chiba.ocn.ne.jp [122.26.37.237]) (user=hrs mech=DIGEST-MD5 bits=128) by mail.vlsi.ee.noda.tus.ac.jp (8.14.4/8.14.4) with ESMTP id p5C5jRD6048447 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 12 Jun 2011 14:45:37 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id p5C5jPcL048399; Sun, 12 Jun 2011 14:45:27 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Sun, 12 Jun 2011 14:45:07 +0900 (JST) Message-Id: <20110612.144507.1094074416533508207.hrs@allbsd.org> To: melifaro@ipfw.ru From: Hiroki Sato In-Reply-To: <4DF43813.5020508@ipfw.ru> References: <20110612.055610.725598761140735688.hrs@allbsd.org> <4DF43813.5020508@ipfw.ru> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.3 on Emacs 23.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Sun_Jun_12_14_45_07_2011_678)--" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.vlsi.ee.noda.tus.ac.jp [133.31.107.40]); Sun, 12 Jun 2011 14:45:38 +0900 (JST) X-Spam-Status: No, score=6.3 required=14.0 tests=BAYES_50, CONTENT_TYPE_PRESENT, QENCPTR1,RCVD_IN_PBL,RCVD_IN_RP_RNBL,SPF_SOFTFAIL,X_MAILER_PRESENT autolearn=no version=3.3.1 X-Spam-Level: ****** X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.vlsi.ee.noda.tus.ac.jp Cc: dougb@FreeBSD.org, pluknet@gmail.com, freebsd-rc@FreeBSD.org Subject: Re: [CFR] rc.conf interface description 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, 12 Jun 2011 05:45:43 -0000 ----Security_Multipart0(Sun_Jun_12_14_45_07_2011_678)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Sun_Jun_12_14_45_07_2011_590)--" Content-Transfer-Encoding: 7bit ----Next_Part(Sun_Jun_12_14_45_07_2011_590)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit "Alexander V. Chernikov" wrote in <4DF43813.5020508@ipfw.ru>: me> -----BEGIN PGP SIGNED MESSAGE----- me> Hash: SHA1 me> me> Hiroki Sato wrote: me> > Sergey Kandaurov wrote me> > in : me> > me> > pl> Hello. me> > pl> me> > pl> Some time ago there was a discussion about ifconfig descr integration me> > pl> into rc. That means you can store interface descriptions in rc.conf file, me> > pl> so that the descriptions survive between system reboots. To achieve it, me> > pl> you need to place one-line option into rc.conf, e.g. like this: me> > pl> ifconfig_em0_descr="Uplink to Gigabit Switch 1", or me> > pl> ifconfig_vlan8_descr="description '1 2 3' vlan 255 vlandev IFACE" me> > pl> me> > pl> so after reboot or manual `rc.d/netif restart $iface` invocation, you''ll see me> > pl> something like this: me> > pl> vlan8: flags=8843 metric 0 mtu 1500 me> > pl> description: description '1 2 3' vlan 255 vlandev IFACE me> > pl> [...] me> > pl> And rc.d/netif stop $iface removes description from a network interface. me> > pl> me> > pl> You can see the previous discussion in -current@ and -rc@ mail archives: me> > pl> http://www.mail-archive.com/freebsd-current@freebsd.org/msg124513.html me> > pl> However, that time it went nowhere due to luck of time/interest. me> > pl> me> > pl> Recently I learned that this patch is actually used. me> > pl> I was requested to integrate it into the head. me> > pl> I'd like to collect your opinions/objections/thoughts to ensure whether me> > pl> there are might be issues preventing from committing it. me> > me> > I have no strong objection but I am still wondering if we really need me> > to have the dedicated variable for ifconfig descr. Is simply me> > specifying ifconfig_IF="descr FOO" not enough? me> me> Unfortunately it is not. You can't (easily) set interface description me> like 'FOO BAR' via ifconfig_IF. Please see conf/156675 for a bit longer me> desciption. If the primary issue is that escape characters do not work properly, the attached patch should fix that. This escape character problem may also involve other options which accept white spaces such as group, maclabel, ssid, or wepkey. I think this is a bug in the rc.d framework and supporting \ and ' in ifconfig_IF is simpler and more intuitive than having an ifconfig_IF_xxx line for each. -- Hiroki ----Next_Part(Sun_Jun_12_14_45_07_2011_590)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="network.subr_20110612-1.diff" Index: etc/network.subr =================================================================== --- etc/network.subr (revision 222996) +++ etc/network.subr (working copy) @@ -94,7 +94,7 @@ # ifconfig_IF ifconfig_args=`ifconfig_getargs $1` if [ -n "${ifconfig_args}" ]; then - ifconfig $1 ${ifconfig_args} + eval ifconfig $1 ${ifconfig_args} _cfg=0 fi ----Next_Part(Sun_Jun_12_14_45_07_2011_590)---- ----Security_Multipart0(Sun_Jun_12_14_45_07_2011_678)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk30UmMACgkQTyzT2CeTzy2YfQCfbGglKeUfxakzuBBRaol9/xDd lMkAnRW+p6P1Al2GICHmRdNZ3RgdoxQh =qkoA -----END PGP SIGNATURE----- ----Security_Multipart0(Sun_Jun_12_14_45_07_2011_678)---- From owner-freebsd-rc@FreeBSD.ORG Sun Jun 12 12:41:30 2011 Return-Path: Delivered-To: rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBBED1065670 for ; Sun, 12 Jun 2011 12:41:30 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id A89BE8FC0A for ; Sun, 12 Jun 2011 12:41:30 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArgGALiz9E2DaFvO/2dsb2JhbABSG4Quk06PLqpTjkaPVYErg2+BCgSRNI95 X-IronPort-AV: E=Sophos;i="4.65,354,1304308800"; d="scan'208";a="127621903" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 12 Jun 2011 08:41:29 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id B89F4B3F06 for ; Sun, 12 Jun 2011 08:41:29 -0400 (EDT) Date: Sun, 12 Jun 2011 08:41:29 -0400 (EDT) From: Rick Macklem To: rc@freebsd.org Message-ID: <1257787327.444098.1307882489747.JavaMail.root@erie.cs.uoguelph.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.201] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: Subject: Re: scripts for review 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, 12 Jun 2011 12:41:31 -0000 Hi, Hope you don't mind, but I committed the 3 one line changes without review, since I am away next week and wanted them in for code slush. I left the larger change to mountcritremote out, since it could be riskier at this time (although it seems to work ok for me). There is the nfsd change that I think allows nfsserver to be deleted. I'll leave that one at http://people.freebsd.org/~rmacklem/rc.conf for review when someone has the time to do it. rick From owner-freebsd-rc@FreeBSD.ORG Mon Jun 13 11:07:11 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 445D4106566B for ; Mon, 13 Jun 2011 11:07:11 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 324CF8FC26 for ; Mon, 13 Jun 2011 11:07:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p5DB7B7h092176 for ; Mon, 13 Jun 2011 11:07:11 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p5DB7ASA092174 for freebsd-rc@FreeBSD.org; Mon, 13 Jun 2011 11:07:10 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 13 Jun 2011 11:07:10 GMT Message-Id: <201106131107.p5DB7ASA092174@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-rc@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-rc@FreeBSD.org 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, 13 Jun 2011 11:07:11 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o conf/157687 rc [patch] /etc/rc.d/quota and quotaon args o conf/155006 rc [patch] named(8): /etc/rc.d/named might set wrong pid o conf/154554 rc [rc.d] [patch] statd and lockd fail to start o conf/153666 rc [rc.d][patch] mount filesystems from fstab over zfs da o conf/153200 rc post-boot /etc/rc.d/network_ipv6 start can miss neighb o conf/153123 rc [rc] [patch] add gsched rc file to automatically inser o conf/152784 rc services provide himself instead providing class of se o conf/150752 rc [rc.subr] [patch] be not needed to eval $_pidcmd on re o conf/150474 rc [patch] rc.d/accounting: Add ability to set location o o conf/149867 rc [PATCH] rc.d script to manage multiple FIBS (kern opti o conf/149831 rc [PATCH] add support to /etc/rc.d/jail for delegating Z o conf/148656 rc rc.firewall(8): {oip} and {iip} variables in rc.firewa o conf/147685 rc [rc.d] [patch] new feature for /etc/rc.d/fsck o conf/147444 rc [rc.d] [patch] /etc/rc.d/zfs stop not called on reboot o conf/146053 rc [patch] [request] shutdown of jails breaks inter-jail o conf/145445 rc [rc.d] error in /etc/rc.d/jail (bad logic) o conf/145440 rc [rc.d] [patch] add multiple fib support (setfib) in /e o conf/145399 rc [patch] rc.d scripts are unable to start/stop programs o conf/145344 rc [patch] Fix kitchen sink approach for rc.d scripts ins o conf/145009 rc [patch] rc.subr(8): rc.conf should allow mac label con o conf/144213 rc [rc.d] [patch] Disappearing zvols on reboot o conf/143637 rc [patch] ntpdate(8) support for ntp-servers supplied by o conf/143085 rc [patch] ftp-proxy(8) rc(8) with multiple instances o conf/143084 rc [jail] [patch]: fix rc.d/jail creating stray softlinks o conf/142973 rc [jail] [patch] Strange counter init value in jail rc o conf/142434 rc [patch] Add cpuset(1) support to rc.subr(8) o conf/142304 rc rc.conf(5): mdconfig and mdconfig2 rc.d scripts lack e o conf/141909 rc rc.subr(8): [patch] add rc.conf.d support to /usr/loca o conf/141907 rc [rc.d] Bug if mtu (maybe others?) is set as first argu o conf/141678 rc [patch] A minor enhancement to how /etc/rc.d/jail dete o conf/141275 rc [request] dhclient(8) rc script should print something o conf/140440 rc [patch] allow local command files in rc.{suspend,resum o conf/140261 rc [patch] Improve flexibility of mdconfig2 startup scrip o conf/138208 rc [rc.d] [patch] Making rc.firewall (workstation) IPv6 a o conf/137629 rc [rc.d] background_dhclient rc.conf option causing doub o conf/137470 rc [PATCH] /etc/rc.d/mdconfig2 : prioritize cli parameter o conf/137271 rc [rc.d] Cannot update /etc/host.conf when root filesyst o conf/136875 rc [request] _flags appending o conf/136624 rc [rc.d] sysctl variables for ipnat are not applied on b o conf/135338 rc [rc.d] pf startup order seems broken [regression] o conf/134918 rc [patch] rc.subr fails to detect perl daemons o conf/134660 rc [patch] rc-script for initializing ng_netflow+ng_ipfw o conf/134333 rc PPP configuration problem in the rc.d scripts in combi o conf/134006 rc [patch] Unload console screensaver kernel modules if s o conf/133987 rc [rc.d] defaultroute broken with DHCP in some cases o conf/133890 rc [patch] sshd(8): add multiple profiles to the rc.d scr o conf/132483 rc rc.subr(8) [patch] setfib(1) support for rc.subr o conf/132476 rc [rc.d] [patch] add support setfib(1) in rc.d/routing o conf/128299 rc [patch] /etc/rc.d/geli does not mount partitions using o bin/126562 rc rcorder(8) fails to run unrelated startup scripts when o conf/126392 rc [patch] rc.conf ifconfig_xx keywords cannot be escaped p bin/126324 rc [patch] rc.d/tmp: Prevent mounting /tmp in second tim o conf/124747 rc [patch] savecore can't create dump from encrypted swap o conf/124248 rc [jail] [patch] add support for nice value for rc.d/jai o conf/123734 rc [patch] Chipset VIA CX700 requires extra initializatio o conf/123222 rc [patch] Add rtprio(1)/idprio(1) support to rc.subr(8). o conf/122968 rc [rc.d] /etc/rc.d/addswap: md swapfile multiplication a o conf/122477 rc [patch] /etc/rc.d/mdconfig and mdconfig2 are ignoring o conf/122170 rc [patch] [request] New feature: notify admin via page o o kern/121566 rc [nfs] [request] [patch] ethernet iface should be broug o conf/120431 rc [patch] devfs.rules are not initialized under certain o conf/120406 rc [devd] [patch] Handle newly attached pcm devices (eg. o conf/119874 rc [patch] "/etc/rc.d/pf reload" fails if there are macro o conf/119076 rc [patch] [rc.d] /etc/rc.d/netif tries to remove alias a o bin/118325 rc [patch] [request] new periodic script to test statuses o conf/118255 rc savecore never finding kernel core dumps (rcorder prob o conf/117935 rc [patch] ppp fails to start at boot because of missing o conf/113915 rc [patch] ndis wireless driver fails to associate when i o conf/109980 rc /etc/rc.d/netif restart doesn't destroy cloned_interfa o conf/109562 rc [rc.d] [patch] [request] Make rc.d/devfs usable from c o conf/109272 rc [request] increase default rc shutdown timeout o conf/108589 rc rtsol(8) fails due to default ipfw rules o conf/106009 rc [ppp] [patch] [request] Fix pppoed startup script to p o conf/105689 rc [ppp] [request] syslogd starts too late at boot o conf/105568 rc [patch] [request] Add more flexibility to rc.conf, to o conf/105145 rc [ppp] [patch] [request] add redial function to rc.d/pp o conf/104549 rc [patch] rc.d/nfsd needs special _find_processes functi o conf/102700 rc [geli] [patch] Add encrypted /tmp support to GELI/GBDE o conf/99721 rc [patch] /etc/rc.initdiskless problem copy dotfile in s o conf/99444 rc [patch] Enhancement: rc.subr could easily support star o conf/96343 rc [patch] rc.d order change to start inet6 before pf o conf/93815 rc [patch] Adds in the ability to save ipfw rules to rc.d o conf/92523 rc [patch] allow rc scripts to kill process after a timeo o conf/89870 rc [patch] [request] make netif verbose rc.conf toggle o conf/89061 rc [patch] IPv6 6to4 auto-configuration enhancement o conf/88913 rc [patch] wrapper support for rc.subr o conf/85819 rc [patch] script allowing multiuser mode in spite of fsc o kern/81006 rc ipnat not working with tunnel interfaces on startup o conf/77663 rc Suggestion: add /etc/rc.d/addnetswap after addcritremo o conf/73677 rc [patch] add support for powernow states to power_profi o conf/58939 rc [patch] dumb little hack for /etc/rc.firewall{,6} o conf/56934 rc [patch] rc.firewall rules for natd expect an interface o conf/45226 rc [patch] Fix for rc.network, ppp-user annoyance o conf/44170 rc [patch] Add ability to run multiple pppoed(8) on start 94 problems total. From owner-freebsd-rc@FreeBSD.ORG Mon Jun 13 15:56:33 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DC2C106564A; Mon, 13 Jun 2011 15:56:33 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 54FBB8FC19; Mon, 13 Jun 2011 15:56:33 +0000 (UTC) Received: from sbhfislrext01.fnfis.com ([192.168.249.167]) by SCSFISLTC02 (8.14.3/8.14.3) with ESMTP id p5DFuW1C011202; Mon, 13 Jun 2011 10:56:32 -0500 Received: from SBHFISLTCGW07.FNFIS.COM (Not Verified[10.132.248.135]) by sbhfislrext01.fnfis.com with MailMarshal (v6, 5, 4, 7535) id ; Mon, 13 Jun 2011 10:56:37 -0500 Received: from SBHFISLTCGW07.FNFIS.COM ([10.132.248.135]) by SBHFISLTCGW07.FNFIS.COM with Microsoft SMTPSVC(6.0.3790.4675); Mon, 13 Jun 2011 10:56:32 -0500 Received: from lummox ([10.132.254.136]) by SBHFISLTCGW07.FNFIS.COM over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 13 Jun 2011 10:56:32 -0500 From: "Devin Teske" To: "'Hiroki Sato'" , References: <20110612.055610.725598761140735688.hrs@allbsd.org><4DF43813.5020508@ipfw.ru> <20110612.144507.1094074416533508207.hrs@allbsd.org> Date: Mon, 13 Jun 2011 08:56:26 -0700 Message-ID: <46679FEE6B76484CB679F123905ABF93@shxd.ath.cx> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <20110612.144507.1094074416533508207.hrs@allbsd.org> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 Thread-Index: Acwow9QnUOJcej+SRSq0c9IcNIFFqwBHmlzg X-OriginalArrivalTime: 13 Jun 2011 15:56:32.0512 (UTC) FILETIME=[77245800:01CC29E2] Cc: dougb@FreeBSD.org, freebsd-rc@FreeBSD.org, pluknet@gmail.com Subject: RE: [CFR] rc.conf interface description 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, 13 Jun 2011 15:56:33 -0000 > -----Original Message----- > From: owner-freebsd-rc@freebsd.org [mailto:owner-freebsd-rc@freebsd.org] > On Behalf Of Hiroki Sato > Sent: Saturday, June 11, 2011 10:45 PM > To: melifaro@ipfw.ru > Cc: dougb@FreeBSD.org; pluknet@gmail.com; freebsd-rc@FreeBSD.org > Subject: Re: [CFR] rc.conf interface description > > "Alexander V. Chernikov" wrote > in <4DF43813.5020508@ipfw.ru>: > > me> -----BEGIN PGP SIGNED MESSAGE----- > me> Hash: SHA1 > me> > me> Hiroki Sato wrote: > me> > Sergey Kandaurov wrote > me> > in : > me> > > me> > pl> Hello. > me> > pl> > me> > pl> Some time ago there was a discussion about ifconfig descr > integration > me> > pl> into rc. That means you can store interface descriptions in > rc.conf file, > me> > pl> so that the descriptions survive between system reboots. To > achieve it, > me> > pl> you need to place one-line option into rc.conf, e.g. like this: > me> > pl> ifconfig_em0_descr="Uplink to Gigabit Switch 1", or > me> > pl> ifconfig_vlan8_descr="description '1 2 3' vlan 255 vlandev > IFACE" > me> > pl> > me> > pl> so after reboot or manual `rc.d/netif restart $iface` > invocation, you''ll see > me> > pl> something like this: > me> > pl> vlan8: flags=8843 metric > 0 mtu 1500 > me> > pl> description: description '1 2 3' vlan 255 vlandev IFACE > me> > pl> [...] > me> > pl> And rc.d/netif stop $iface removes description from a network > interface. > me> > pl> > me> > pl> You can see the previous discussion in -current@ and -rc@ mail > archives: > me> > pl> http://www.mail-archive.com/freebsd- > current@freebsd.org/msg124513.html > me> > pl> However, that time it went nowhere due to luck of time/interest. > me> > pl> > me> > pl> Recently I learned that this patch is actually used. > me> > pl> I was requested to integrate it into the head. > me> > pl> I'd like to collect your opinions/objections/thoughts to ensure > whether > me> > pl> there are might be issues preventing from committing it. > me> > > me> > I have no strong objection but I am still wondering if we really > need > me> > to have the dedicated variable for ifconfig descr. Is simply > me> > specifying ifconfig_IF="descr FOO" not enough? > me> > me> Unfortunately it is not. You can't (easily) set interface description > me> like 'FOO BAR' via ifconfig_IF. Please see conf/156675 for a bit > longer > me> desciption. > > If the primary issue is that escape characters do not work properly, > the attached patch should fix that. > > This escape character problem may also involve other options which > accept white spaces such as group, maclabel, ssid, or wepkey. I > think this is a bug in the rc.d framework and supporting \ and ' in > ifconfig_IF is simpler and more intuitive than having an > ifconfig_IF_xxx line for each. +1 to Hiroki's logic. -- Devin _____________ 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. _____________ From owner-freebsd-rc@FreeBSD.ORG Mon Jun 13 16:05:04 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F5871065673; Mon, 13 Jun 2011 16:05:04 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from no.spam.no.ddos.ru (no.spam.no.ddos.ru [IPv6:2a02:978:2:1000::3]) by mx1.freebsd.org (Postfix) with ESMTP id C7AB88FC13; Mon, 13 Jun 2011 16:05:03 +0000 (UTC) Received: from ws.su29.net (v6.mpls.in [IPv6:2a02:978:2::5]) by no.spam.no.ddos.ru (Postfix) with ESMTPA id 442683812B6; Mon, 13 Jun 2011 20:03:26 +0400 (MSD) Message-ID: <4DF634C3.6020201@ipfw.ru> Date: Mon, 13 Jun 2011 20:03:15 +0400 From: "Alexander V. Chernikov" User-Agent: Thunderbird 2.0.0.24 (X11/20100515) MIME-Version: 1.0 To: Devin Teske References: <20110612.055610.725598761140735688.hrs@allbsd.org><4DF43813.5020508@ipfw.ru> <20110612.144507.1094074416533508207.hrs@allbsd.org> <46679FEE6B76484CB679F123905ABF93@shxd.ath.cx> In-Reply-To: <46679FEE6B76484CB679F123905ABF93@shxd.ath.cx> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: dougb@FreeBSD.org, 'Hiroki Sato' , freebsd-rc@FreeBSD.org, pluknet@gmail.com Subject: Re: [CFR] rc.conf interface description 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, 13 Jun 2011 16:05:04 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Devin Teske wrote: > >> -----Original Message----- >> From: owner-freebsd-rc@freebsd.org [mailto:owner-freebsd-rc@freebsd.org] >> On Behalf Of Hiroki Sato >> Sent: Saturday, June 11, 2011 10:45 PM >> To: melifaro@ipfw.ru >> Cc: dougb@FreeBSD.org; pluknet@gmail.com; freebsd-rc@FreeBSD.org >> Subject: Re: [CFR] rc.conf interface description >> >> "Alexander V. Chernikov" wrote >> in <4DF43813.5020508@ipfw.ru>: >> >> me> -----BEGIN PGP SIGNED MESSAGE----- >> me> Hash: SHA1 >> me> >> me> Hiroki Sato wrote: >> me> > Sergey Kandaurov wrote >> me> > in : >> me> > >> me> > pl> Hello. >> me> > pl> >> me> > pl> Some time ago there was a discussion about ifconfig descr >> integration >> me> > pl> into rc. That means you can store interface descriptions in >> rc.conf file, >> me> > pl> so that the descriptions survive between system reboots. To >> achieve it, >> me> > pl> you need to place one-line option into rc.conf, e.g. like this: >> me> > pl> ifconfig_em0_descr="Uplink to Gigabit Switch 1", or >> me> > pl> ifconfig_vlan8_descr="description '1 2 3' vlan 255 vlandev >> IFACE" >> me> > pl> >> me> > pl> so after reboot or manual `rc.d/netif restart $iface` >> invocation, you''ll see >> me> > pl> something like this: >> me> > pl> vlan8: flags=8843 metric >> 0 mtu 1500 >> me> > pl> description: description '1 2 3' vlan 255 vlandev IFACE >> me> > pl> [...] >> me> > pl> And rc.d/netif stop $iface removes description from a network >> interface. >> me> > pl> >> me> > pl> You can see the previous discussion in -current@ and -rc@ mail >> archives: >> me> > pl> http://www.mail-archive.com/freebsd- >> current@freebsd.org/msg124513.html >> me> > pl> However, that time it went nowhere due to luck of time/interest. >> me> > pl> >> me> > pl> Recently I learned that this patch is actually used. >> me> > pl> I was requested to integrate it into the head. >> me> > pl> I'd like to collect your opinions/objections/thoughts to ensure >> whether >> me> > pl> there are might be issues preventing from committing it. >> me> > >> me> > I have no strong objection but I am still wondering if we really >> need >> me> > to have the dedicated variable for ifconfig descr. Is simply >> me> > specifying ifconfig_IF="descr FOO" not enough? >> me> >> me> Unfortunately it is not. You can't (easily) set interface description >> me> like 'FOO BAR' via ifconfig_IF. Please see conf/156675 for a bit >> longer >> me> desciption. >> >> If the primary issue is that escape characters do not work properly, >> the attached patch should fix that. >> >> This escape character problem may also involve other options which >> accept white spaces such as group, maclabel, ssid, or wepkey. I >> think this is a bug in the rc.d framework and supporting \ and ' in >> ifconfig_IF is simpler and more intuitive than having an >> ifconfig_IF_xxx line for each. > > +1 to Hiroki's logic. For me the primary issue is problem with character escaping. Single-line interface configuration (not mentioning IPv6) without complex escaping is more preferable than introducing additional line for description -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk32NMMACgkQwcJ4iSZ1q2nTdQCfWDoyFn/6ykoUjvopvYFDZGcw WtoAoIOmw1g0I2vmB7cM5OCy9z7fHh/p =LeaS -----END PGP SIGNATURE----- From owner-freebsd-rc@FreeBSD.ORG Tue Jun 14 03:23:43 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70E06106564A for ; Tue, 14 Jun 2011 03:23:43 +0000 (UTC) (envelope-from jwd@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 481428FC13 for ; Tue, 14 Jun 2011 03:23:43 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p5E3Nh8M006209 for ; Tue, 14 Jun 2011 03:23:43 GMT (envelope-from jwd@freefall.freebsd.org) Received: (from jwd@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p5E3Nh9a006208 for freebsd-rc@FreeBSD.org; Tue, 14 Jun 2011 03:23:43 GMT (envelope-from jwd) Date: Tue, 14 Jun 2011 03:23:43 +0000 From: John To: freebsd-rc@FreeBSD.org Message-ID: <20110614032343.GA96959@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Cc: Subject: Downtime report rc script? 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: Tue, 14 Jun 2011 03:23:43 -0000 Hi Folks, I'm trying to put together a simple to report at boot time how long the system was down. The script itself isn't really a problem, but I'm coming up short looking for a reliable way to determine exactly when the sytem went down regardless of whether it was a clean reboot or a crash. Am I missing something simple? I've thought about writing a simple little program to touch a file once per second invoked by the downtime rc script after querying the last time the file was touched... but there must be a simpler solution. Thoughts? Thanks, John From owner-freebsd-rc@FreeBSD.ORG Tue Jun 14 03:47:23 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFDF6106564A for ; Tue, 14 Jun 2011 03:47:23 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id B08398FC0A for ; Tue, 14 Jun 2011 03:47:23 +0000 (UTC) Received: from 63.imp.bsdimp.com (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p5E3hKqK081470 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Mon, 13 Jun 2011 21:43:20 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <20110614032343.GA96959@FreeBSD.org> Date: Mon, 13 Jun 2011 21:43:15 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20110614032343.GA96959@FreeBSD.org> To: John X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Mon, 13 Jun 2011 21:43:21 -0600 (MDT) Cc: freebsd-rc@freebsd.org Subject: Re: Downtime report rc script? 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: Tue, 14 Jun 2011 03:47:24 -0000 man last(1). You might need to tweak the newsyslog retention time for = the files... Warner On Jun 13, 2011, at 9:23 PM, John wrote: >=20 > Hi Folks, >=20 > I'm trying to put together a simple to report at boot time how > long the system was down. >=20 > The script itself isn't really a problem, but I'm coming up short > looking for a reliable way to determine exactly when the sytem > went down regardless of whether it was a clean reboot or a crash. >=20 > Am I missing something simple? I've thought about writing a simple > little program to touch a file once per second invoked by the downtime > rc script after querying the last time the file was touched... but > there must be a simpler solution. >=20 > Thoughts? >=20 > Thanks, > John >=20 > _______________________________________________ > freebsd-rc@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-rc > To unsubscribe, send any mail to "freebsd-rc-unsubscribe@freebsd.org" >=20 >=20 From owner-freebsd-rc@FreeBSD.ORG Tue Jun 14 13:35:58 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E161C106564A for ; Tue, 14 Jun 2011 13:35:57 +0000 (UTC) (envelope-from cmdlnkid@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9E8508FC1A for ; Tue, 14 Jun 2011 13:35:57 +0000 (UTC) Received: by iwn33 with SMTP id 33so6863150iwn.13 for ; Tue, 14 Jun 2011 06:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to; bh=XwFDFJmO6EuMe7adXTSIfVEBLFxipGgY28tWxFS4KVw=; b=QycFxBfrZOV3ljSfgcZQqpMQK3j3duG3sG7uL345NZL63sh/cMWBsW4oNoXpmuGzsV WfOuzY6QFiD+PMA61vJ9zBRY5OkLldjzwjiCuyqhTsMsTrA4Itt/9ITpekUzpkgJm3gw huPiTYGMF8j2wwcK2cReAn2XT9chSgxxdNQ4c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; b=goxqX2UZXonmHNkRy9IFCa3PDQCqDwLzsb6V7Rzm96df56zzMhspX9vKbA13t3PRuX 3vN9SIzBuCvSnRmaMeSDLob3786YmTqalmASGtmo6NY1K3IsEjGfIE34B3OD1Gij39uR Vq9qmUsej+UpKXCLqz9DF0hktkw3HbHde0OS8= Received: by 10.42.75.202 with SMTP id b10mr4883374ick.242.1308057070925; Tue, 14 Jun 2011 06:11:10 -0700 (PDT) Received: from DataIX.net ([99.181.139.216]) by mx.google.com with ESMTPS id r1sm4742360icz.14.2011.06.14.06.11.09 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Jun 2011 06:11:10 -0700 (PDT) Sender: The Command Line Kid Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.4/8.14.4) with ESMTP id p5EDB6jX031954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 14 Jun 2011 09:11:07 -0400 (EDT) (envelope-from jhell@DataIX.net) Received: (from jhell@localhost) by DataIX.net (8.14.4/8.14.4/Submit) id p5EDB6pp031953; Tue, 14 Jun 2011 09:11:06 -0400 (EDT) (envelope-from jhell@DataIX.net) Date: Tue, 14 Jun 2011 09:11:06 -0400 From: jhell To: John Message-ID: <20110614131105.GA27199@DataIX.net> References: <20110614032343.GA96959@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7JfCtLOvnd9MIVvH" Content-Disposition: inline In-Reply-To: <20110614032343.GA96959@FreeBSD.org> Cc: freebsd-rc@freebsd.org Subject: Re: Downtime report rc script? 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: Tue, 14 Jun 2011 13:35:58 -0000 --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 14, 2011 at 03:23:43AM +0000, John wrote: >=20 > Hi Folks, >=20 > I'm trying to put together a simple to report at boot time how > long the system was down. >=20 > The script itself isn't really a problem, but I'm coming up short > looking for a reliable way to determine exactly when the sytem > went down regardless of whether it was a clean reboot or a crash. >=20 > Am I missing something simple? I've thought about writing a simple > little program to touch a file once per second invoked by the downtime > rc script after querying the last time the file was touched... but > there must be a simpler solution. >=20 > Thoughts? >=20 Record the system bootup time, and then every 5 minutes or so the current time with each new record replacing the last. In the shutdown, record the current time that replaces the last recorded current time, so it will give you the actual time the machine was going down as close as possible. Get these two/three things together then you got a fairly close/accurate way to determine how long the system is down when it comes back up. I would suggest using (date -u). sysutils/uptimed has some internal routines for calculating this. you might want to also take a look at that. --7JfCtLOvnd9MIVvH Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) Comment: http://bit.ly/0x89D8547E iQEcBAEBAgAGBQJN913pAAoJEJBXh4mJ2FR+8yUH/3zUpW+6eGlCMOuq+mBEZH3m 360+sIbKNzfABHjz8ZmwzJQHBrMOBqiprqK2G5+GnMGbIEVNozsHJSi4EO9CgNgn asu8CFnBab9DCNwepHsFd11LBv2S6M5kkehknx0a6FQjdVE8m38QibbUOaMaKAAx 3YtVNRkdCU38E9ioz3N538s/7mjgQBFO0hGs3PZV+3m1Gd4BoNVNWDXNp7RTiE8P TKjRh87RdUBT25BamSrSkl+za6SQKTi0jTLepRKBDyk2KUK4esJhDRu2bD3Qi3Lr uVXhk0wKWLMl+cRVgVOruytkG+f/6A9OuhEZkRDOYwylY6y8VzIIwCsdQy+wqxc= =PLZg -----END PGP SIGNATURE----- --7JfCtLOvnd9MIVvH-- From owner-freebsd-rc@FreeBSD.ORG Tue Jun 14 14:13:05 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E14541065677 for ; Tue, 14 Jun 2011 14:13:05 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id AAA1F8FC23 for ; Tue, 14 Jun 2011 14:13:05 +0000 (UTC) Received: by iwn33 with SMTP id 33so6907809iwn.13 for ; Tue, 14 Jun 2011 07:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=io0WSfkuEZfhtwTDgQkTjPDTew82AYK3Zy1Zm+pC8/E=; b=LQ3eA84NSyympdRud6XCKVO2aeECRfkzBTzqRbYUH3qaRVDdcmOOmPTNiy0rjheNyY e+oMJjJVUqC2I/RTf0+3JOgUcW82iaCm4YshnrFBBaoM5uhhciKmWxcYLWsoDfEnCs8h cvhEkH02pQPcb+am6QCrT8XPvB1dRhkydsIxg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=A6GhkfDKZQ7V1fFeB5VK9pQGy4/lKC2SfhAN5Z/qAU0dZsIoa6UWZTbAhejmtocXqI DnZGkpK15SbnWK9bUDh/xNlmAeAynJd4Bnxp+nFHms7BRLTMRn4BSfJUOvRClaFQYFSK GTZxmZ4/EUWjnMQljaKeW56dmVxryAZYNqHDw= Received: by 10.231.119.105 with SMTP id y41mr6984517ibq.27.1308060784099; Tue, 14 Jun 2011 07:13:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.174.70 with HTTP; Tue, 14 Jun 2011 07:12:34 -0700 (PDT) In-Reply-To: <20110614131105.GA27199@DataIX.net> References: <20110614032343.GA96959@FreeBSD.org> <20110614131105.GA27199@DataIX.net> From: Chris Rees Date: Tue, 14 Jun 2011 15:12:34 +0100 Message-ID: To: jhell Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-rc@freebsd.org, John Subject: Re: Downtime report rc script? 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: Tue, 14 Jun 2011 14:13:06 -0000 On 14 June 2011 14:11, jhell wrote: > On Tue, Jun 14, 2011 at 03:23:43AM +0000, John wrote: >> >> Hi Folks, >> >> =A0 =A0I'm trying to put together a simple to report at boot time how >> long the system was down. >> >> =A0 =A0The script itself isn't really a problem, but I'm coming up short >> looking for a reliable way to determine exactly when the sytem >> went down regardless of whether it was a clean reboot or a crash. >> >> =A0 =A0Am I missing something simple? I've thought about writing a simpl= e >> little program to touch a file once per second invoked by the downtime >> rc script after querying the last time the file was touched... but >> there must be a simpler solution. >> >> =A0 =A0Thoughts? >> > > Record the system bootup time, and then every 5 minutes or so the > current time with each new record replacing the last. In the shutdown, > record the current time that replaces the last recorded current time, so > it will give you the actual time the machine was going down as close as > possible. Get these two/three things together then you got a fairly > close/accurate way to determine how long the system is down when it > comes back up. I would suggest using (date -u). > > sysutils/uptimed has some internal routines for calculating this. you > might want to also take a look at that. > Also, the Uptimes Project [1], this one showing my old server before I finally retired it. Chris [1] http://uptimes-project.org/hosts/view/2288 From owner-freebsd-rc@FreeBSD.ORG Tue Jun 14 22:28:49 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 636971065687 for ; Tue, 14 Jun 2011 22:28:49 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 2F79E8FC15 for ; Tue, 14 Jun 2011 22:28:49 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 93CD13593AE for ; Wed, 15 Jun 2011 00:28:48 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 88D1E17496; Wed, 15 Jun 2011 00:28:48 +0200 (CEST) Date: Wed, 15 Jun 2011 00:28:48 +0200 From: Jilles Tjoelker To: freebsd-rc@freebsd.org Message-ID: <20110614222848.GA25563@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [PATCH] Reducing forks in the boot sequence 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: Tue, 14 Jun 2011 22:28:49 -0000 The below patch reduces vm.stats.vm.v_forks at REQUIRE: LOGIN time of a simple 9-current VM by 105 (which is a bit more than 10%). A side effect is that values starting with a hyphen and all whitespace are preserved. All versions of FreeBSD sh fork for a command substitution containing a '.' or 'eval' command because these utilities may cause anything to be invoked; the same thing applies to a command substitution that calls a function. If people want to keep doing this (rather than returning values via variables), I could look into an extension of the optimization for command substitution (and possibly regular subshells) that tries to avoid forking until the script does something that makes it unavoidable (such as setting new traps, changing the current directory, changing shell options). The function _find_processes is pretty slow also for internal reasons. Index: etc/rc.subr =================================================================== --- etc/rc.subr (revision 222648) +++ etc/rc.subr (working copy) @@ -1062,7 +1062,7 @@ # Set defaults if defined. for _var in $rcvar $rcvars; do - _defval=`eval echo "\\\$${_var}_defval"` + eval _defval=\$${_var}_defval if [ -n "$_defval" ]; then eval : \${$_var:=\$${_var}_defval} fi @@ -1070,9 +1070,9 @@ # check obsolete rc.conf variables for _var in $rcvars_obsolete; do - _v=`eval echo \\$$_var` - _msg=`eval echo \\$${_var}_obsolete_msg` - _new=`eval echo \\$${_var}_newvar` + eval _v=\$$_var + eval _msg=\$${_var}_obsolete_msg + eval _new=\$${_var}_newvar case $_v in "") ;; @@ -1743,7 +1743,7 @@ _echoonce() { local _var _msg _mode - _var=`eval echo \\$$1` + eval _var=\$$1 _msg=$2 _mode=$3 -- Jilles Tjoelker From owner-freebsd-rc@FreeBSD.ORG Wed Jun 15 03:45:31 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19810106564A for ; Wed, 15 Jun 2011 03:45:31 +0000 (UTC) (envelope-from cmdlnkid@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C84CB8FC12 for ; Wed, 15 Jun 2011 03:45:30 +0000 (UTC) Received: by iwn33 with SMTP id 33so7584926iwn.13 for ; Tue, 14 Jun 2011 20:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:date:from:to:subject:message-id :mime-version:content-type:content-disposition; bh=+sog7JV1PjSOoHEQ93OsQ06nU6Si1Jfkg9tfd0UW9uI=; b=WvShYymeC6X0rkn3shStGClRspH2/FtaE6zZIx47f++OXxxsOjnJFl+3suDV5CusYg jP6I1+j+391wDv4VJ5dD09q/rlSfSy2Yk1bU41feNIhGI8/HpOjRRUAg3FPKABlJdFAY n7Cfhh1+hiQngMjc2qXRkIO4vOT38WfzQxMGM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-disposition; b=LVLrv6USo9DS4zwrqFkKkHCZKpOkdIG+PGqTvJEOLnnPoSrInK1S5ZK3BKNJbSShEk RL0G+ZOOBeYKINe+jwRDA6ThzpoX7Rt+nqnBr5XIy92LQ4EEzNGL6BOzKyhnJMxC+3lc Ommte6lscXmgl4+8IFhOAJmuhgm4bxYdYn2c0= Received: by 10.231.212.216 with SMTP id gt24mr7168406ibb.145.1308109530233; Tue, 14 Jun 2011 20:45:30 -0700 (PDT) Received: from DataIX.net (adsl-99-181-139-216.dsl.klmzmi.sbcglobal.net [99.181.139.216]) by mx.google.com with ESMTPS id s9sm8481ibe.44.2011.06.14.20.45.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Jun 2011 20:45:29 -0700 (PDT) Sender: The Command Line Kid Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.4/8.14.4) with ESMTP id p5F3jQVx031720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 14 Jun 2011 23:45:27 -0400 (EDT) (envelope-from jhell@DataIX.net) Received: (from jhell@localhost) by DataIX.net (8.14.4/8.14.4/Submit) id p5F3jQJu031719 for freebsd-rc@freebsd.org; Tue, 14 Jun 2011 23:45:26 -0400 (EDT) (envelope-from jhell@DataIX.net) Date: Tue, 14 Jun 2011 23:45:26 -0400 From: jhell To: freebsd-rc@freebsd.org Message-ID: <20110615034526.GA12185@DataIX.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jho1yZJdad60DJr+" Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: [PATCH] Knock out two if statements, one eval & IDCMD with builtin test. 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: Wed, 15 Jun 2011 03:45:31 -0000 --jho1yZJdad60DJr+ Content-Type: multipart/mixed; boundary="OgqxwSJOaUobr8KG" Content-Disposition: inline --OgqxwSJOaUobr8KG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline After looking over Jilles patch on this same list it made ID & IDCMD catch my eye when I seen the $(eval $IDCMD) where it was the only place it was used throughout the whole system in which it calls another if statement from IDCMD to check the presence of /usr/bin/id. This is not bad at all, don't get me wrong but this could be done from one location to knock out the eval and two if statements with one builtin test right from the ID variable itself and get rid of the need for the IDCMD. Slight speed improvement ? maybe... cleaner yes. As for functionality can anyone think of a need to wait for processing this till run_rc_command is thrown ? if so should it be escaped and re-eval'd as $(eval \$ID) or something similiar later ? --OgqxwSJOaUobr8KG-- --jho1yZJdad60DJr+ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) Comment: http://bit.ly/0x89D8547E iQEcBAEBAgAGBQJN+CrUAAoJEJBXh4mJ2FR+K9wIAIo9zUUKRRB0TzPqzBpmz8gb Q6XvX3vzUXHgEA4YOwte7a30wTt4RKwRloORCYljqMtgooCbuDwlTt/8b7UqRfyC pCsXoyB3jy2VAbF9G4TH2iVLu5/qzA28n5RMpUrcrJdwqGh21ADLF3LZsDIb3nIR myzf9xDPevlhlpbe+bDs9aRjEgiZQbqM/9JnMOBfcJU1PHf1+4eJ6N4Pcj2m65mZ zgCBMRBgvjLWD3J6jsEPG5llOaTkYwNEvh8szuChemWGOXxDldhQn5WAQUzG5kGA YVzxdGg21H/VCxLX/nRj09Tq/7XbMRFCju88qslCJ5fBC7h3sXvGvGBm8/QUo3g= =Tfkj -----END PGP SIGNATURE----- --jho1yZJdad60DJr+-- From owner-freebsd-rc@FreeBSD.ORG Wed Jun 15 03:53:06 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3CEE106564A for ; Wed, 15 Jun 2011 03:53:06 +0000 (UTC) (envelope-from cmdlnkid@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 904BF8FC0C for ; Wed, 15 Jun 2011 03:52:50 +0000 (UTC) Received: by iwn33 with SMTP id 33so7589387iwn.13 for ; Tue, 14 Jun 2011 20:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:date:from:to:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to; bh=sDVSvQfANaN99kuDS1KjRa5+reCPWtDPQiHZa7OFP1g=; b=rakVyBAPd62ZP54DdIadWGQ4kD3BXpMsfTPyyafNx4mp+1jCrAPF9KFpr3lmeNwW3F Vv4wlzGW62dWDzlyo47ROeUaZ3CO3yfF/mSNCeMtDHTdA6ODODrGWMaldYX3P8LM19SC JYBsSM/edmjYXpP6bqsvQ6XWErcEO6SvHixmI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; b=ZYnD898lWWhrOq50ZvFT4nPj3XulLchVfR0tWo3EaqRff0Ck2B6sHA9Ze+aFV0uPZV hn8nNj87ECN6675VE3ZCnruGzsu8LrCNghm26p2VCrJAjZUua+6u1b0NMSTwUYSYzb7l 8rNuN4yWK9F2lPJ5sYUsroAe/YtXmbUTykvsY= Received: by 10.42.155.70 with SMTP id t6mr8029515icw.405.1308109969811; Tue, 14 Jun 2011 20:52:49 -0700 (PDT) Received: from DataIX.net (adsl-99-181-139-216.dsl.klmzmi.sbcglobal.net [99.181.139.216]) by mx.google.com with ESMTPS id vo3sm10018icb.22.2011.06.14.20.52.48 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Jun 2011 20:52:49 -0700 (PDT) Sender: The Command Line Kid Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.4/8.14.4) with ESMTP id p5F3qlLM034000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 14 Jun 2011 23:52:47 -0400 (EDT) (envelope-from jhell@DataIX.net) Received: (from jhell@localhost) by DataIX.net (8.14.4/8.14.4/Submit) id p5F3qk7M033999 for freebsd-rc@freebsd.org; Tue, 14 Jun 2011 23:52:46 -0400 (EDT) (envelope-from jhell@DataIX.net) Date: Tue, 14 Jun 2011 23:52:46 -0400 From: jhell To: freebsd-rc@freebsd.org Message-ID: <20110615035246.GB12185@DataIX.net> References: <20110615034526.GA12185@DataIX.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110615034526.GA12185@DataIX.net> Subject: Re: [PATCH] Knock out two if statements, one eval & IDCMD with builtin test. 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: Wed, 15 Jun 2011 03:53:06 -0000 This should have been without the ``false'' On Tue, Jun 14, 2011 at 11:45:26PM -0400, jhell wrote: > > After looking over Jilles patch on this same list it made ID & IDCMD > catch my eye when I seen the $(eval $IDCMD) where it was the only place > it was used throughout the whole system in which it calls another if > statement from IDCMD to check the presence of /usr/bin/id. > > This is not bad at all, don't get me wrong but this could be done from > one location to knock out the eval and two if statements with one > builtin test right from the ID variable itself and get rid of the need > for the IDCMD. > > Slight speed improvement ? maybe... cleaner yes. > > As for functionality can anyone think of a need to wait for processing > this till run_rc_command is thrown ? if so should it be escaped and > re-eval'd as $(eval \$ID) or something similiar later ? > From owner-freebsd-rc@FreeBSD.ORG Wed Jun 15 21:02:57 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 010261065672 for ; Wed, 15 Jun 2011 21:02:57 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 96E528FC0A for ; Wed, 15 Jun 2011 21:02:56 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id ECE153593E3; Wed, 15 Jun 2011 23:02:55 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id D922517399; Wed, 15 Jun 2011 23:02:55 +0200 (CEST) Date: Wed, 15 Jun 2011 23:02:55 +0200 From: Jilles Tjoelker To: jhell Message-ID: <20110615210255.GA44402@stack.nl> References: <20110615034526.GA12185@DataIX.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110615034526.GA12185@DataIX.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-rc@freebsd.org Subject: Re: [PATCH] Knock out two if statements, one eval & IDCMD with builtin test. 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: Wed, 15 Jun 2011 21:02:57 -0000 On Tue, Jun 14, 2011 at 11:45:26PM -0400, jhell wrote: > After looking over Jilles patch on this same list it made ID & IDCMD > catch my eye when I seen the $(eval $IDCMD) where it was the only place > it was used throughout the whole system in which it calls another if > statement from IDCMD to check the presence of /usr/bin/id. > This is not bad at all, don't get me wrong but this could be done from > one location to knock out the eval and two if statements with one > builtin test right from the ID variable itself and get rid of the need > for the IDCMD. > Slight speed improvement ? maybe... cleaner yes. There is no patch included. Maybe you forgot it or the mailing list software ate it? > As for functionality can anyone think of a need to wait for processing > this till run_rc_command is thrown ? if so should it be escaped and > re-eval'd as $(eval \$ID) or something similiar later ? It is useful to postpone the check because it usually is not necessary at all. The id command only needs to be executed if ${name}_user is set. Also note that when /etc/rc.subr is sourced for the first time, /usr may not be mounted. Therefore the unavailability of /usr/bin/id must not be cached. As for performance, expanding "$(eval $IDCMD)" currently takes two forks (assuming /usr/bin/id is executable), which can be reduced to one with a simple tweak to sh (only for 9.x sh though, not 8.x). The second fork can also be avoided by rearranging the script, just using "$($ID)" and checking its existence outside command substitution. Index: bin/sh/eval.c =================================================================== --- bin/sh/eval.c (revision 223024) +++ bin/sh/eval.c (working copy) @@ -140,7 +140,7 @@ STPUTC('\0', concat); p = grabstackstr(concat); } - evalstring(p, builtin_flags & EV_TESTED); + evalstring(p, builtin_flags); } else exitstatus = 0; return exitstatus; @@ -908,6 +908,7 @@ dup2(pip[1], 1); close(pip[1]); } + flags &= ~EV_BACKCMD; } flags |= EV_EXIT; } -- Jilles Tjoelker From owner-freebsd-rc@FreeBSD.ORG Thu Jun 16 13:40:41 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95BA5106567B for ; Thu, 16 Jun 2011 13:40:41 +0000 (UTC) (envelope-from cmdlnkid@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 538788FC0C for ; Thu, 16 Jun 2011 13:40:40 +0000 (UTC) Received: by iwr19 with SMTP id 19so431929iwr.13 for ; Thu, 16 Jun 2011 06:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to; bh=LTRPyetUINalzCNg3jLwdjU49WtWEMToNwTUvTQzHlc=; b=A0QZnmXuKoFdOWYQ6ANnvKl/TE9i4At9ObCIr5jpgezKWiEc39+26ok6t29eZkL9xr aIvc1jDwcHkyhHIU6TC7WWgu6XVvXX4afhJSamnRfwxOV9cncAramSdFfF0HDQRgt9fK aTwKi71BOP7Z3tV7yNiLhQzFCgHc09gm9gduI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; b=egB4FGJ9M2wEcDVcBaGuPMjtH7iie8WgfY6tSnPMZssPYTRxFkJbXjq3iGJ9y6Aa4M 47LL4x2HrGiLNDEkVC/UUsayAA5YZv2lXB38TtY6SLw6eblXG6Ws4+TW3XDGGNzWAD00 h00Ypguw+xTnEoRRn8DWH5hDxRu6kjOI4JYuE= Received: by 10.42.222.10 with SMTP id ie10mr846215icb.350.1308231640451; Thu, 16 Jun 2011 06:40:40 -0700 (PDT) Received: from DataIX.net (adsl-99-181-139-216.dsl.klmzmi.sbcglobal.net [99.181.139.216]) by mx.google.com with ESMTPS id c9sm14625ibi.23.2011.06.16.06.40.38 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 16 Jun 2011 06:40:39 -0700 (PDT) Sender: The Command Line Kid Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.4/8.14.4) with ESMTP id p5GDeYoZ019214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Jun 2011 09:40:34 -0400 (EDT) (envelope-from jhell@DataIX.net) Received: (from jhell@localhost) by DataIX.net (8.14.4/8.14.4/Submit) id p5GDeW05019213; Thu, 16 Jun 2011 09:40:32 -0400 (EDT) (envelope-from jhell@DataIX.net) Date: Thu, 16 Jun 2011 09:40:32 -0400 From: jhell To: Jilles Tjoelker Message-ID: <20110616134032.GA17614@DataIX.net> References: <20110615034526.GA12185@DataIX.net> <20110615210255.GA44402@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110615210255.GA44402@stack.nl> Cc: freebsd-rc@freebsd.org Subject: Re: [PATCH] Knock out two if statements, one eval & IDCMD with builtin test. 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: Thu, 16 Jun 2011 13:40:41 -0000 On Wed, Jun 15, 2011 at 11:02:55PM +0200, Jilles Tjoelker wrote: > On Tue, Jun 14, 2011 at 11:45:26PM -0400, jhell wrote: > > After looking over Jilles patch on this same list it made ID & IDCMD > > catch my eye when I seen the $(eval $IDCMD) where it was the only place > > it was used throughout the whole system in which it calls another if > > statement from IDCMD to check the presence of /usr/bin/id. > > > This is not bad at all, don't get me wrong but this could be done from > > one location to knock out the eval and two if statements with one > > builtin test right from the ID variable itself and get rid of the need > > for the IDCMD. > > > Slight speed improvement ? maybe... cleaner yes. > > There is no patch included. Maybe you forgot it or the mailing list > software ate it? Hmmm thats pretty silly ;) it was attached at some point as it shows in my sent box ;). somthing got hungry. > > > As for functionality can anyone think of a need to wait for processing > > this till run_rc_command is thrown ? if so should it be escaped and > > re-eval'd as $(eval \$ID) or something similiar later ? > > It is useful to postpone the check because it usually is not necessary > at all. The id command only needs to be executed if ${name}_user is set. > Agree'd I kept it as close to the original as possible without trying to do so much like the if statement in the IDCMD and the second if statement thats nested below in run_rc_command. I believe at least this is close or doing the same thing but with less checking. > Also note that when /etc/rc.subr is sourced for the first time, /usr may > not be mounted. Therefore the unavailability of /usr/bin/id must not be > cached. As for this caching this may actually need to be changed in what I have. I might need to change it to ID='$(...)' so it could be eval'd at a later point instead if that sounds good to you. I just don't see the need for using two variables whereas we can use one with single quotes and less if statements but like I said its only minor but something that stood out at me when I seen it and made me question it. Patch sourced in: --- rc.subr.orig 2011-06-14 22:46:26.000000000 -0400 +++ rc.subr 2011-06-14 23:25:19.000000000 -0400 @@ -46,8 +46,7 @@ SYSCTL="/sbin/sysctl" SYSCTL_N="${SYSCTL} -n" SYSCTL_W="${SYSCTL}" -ID="/usr/bin/id" -IDCMD="if [ -x $ID ]; then $ID -un; fi" +ID=$(test -x /usr/bin/ids && /usr/bin/id -un || false) PS="/bin/ps -ww" JID=`$PS -p $$ -o jid=` @@ -677,10 +676,9 @@ _nice=\$${name}_nice _user=\$${name}_user \ _group=\$${name}_group _groups=\$${name}_groups - if [ -n "$_user" ]; then # unset $_user if running as that user - if [ "$_user" = "$(eval $IDCMD)" ]; then - unset _user - fi + # unset $_user if running as that user + if [ -n "$_user" -a "$_user" = "$ID" ]; then + unset _user fi eval $_pidcmd # determine the pid if necessary > > As for performance, expanding "$(eval $IDCMD)" currently takes two forks > (assuming /usr/bin/id is executable), which can be reduced to one with a > simple tweak to sh (only for 9.x sh though, not 8.x). The second fork > can also be avoided by rearranging the script, just using "$($ID)" > and checking its existence outside command substitution. > > Index: bin/sh/eval.c > =================================================================== > --- bin/sh/eval.c (revision 223024) > +++ bin/sh/eval.c (working copy) > @@ -140,7 +140,7 @@ > STPUTC('\0', concat); > p = grabstackstr(concat); > } > - evalstring(p, builtin_flags & EV_TESTED); > + evalstring(p, builtin_flags); > } else > exitstatus = 0; > return exitstatus; > @@ -908,6 +908,7 @@ > dup2(pip[1], 1); > close(pip[1]); > } > + flags &= ~EV_BACKCMD; > } > flags |= EV_EXIT; > } > I like this! seems like a good idea. agree'd for 9.X only.