From owner-freebsd-rc@FreeBSD.ORG Mon Apr 18 11:07:07 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 99B5A106567F for ; Mon, 18 Apr 2011 11:07:07 +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 7C2D38FC08 for ; Mon, 18 Apr 2011 11:07:07 +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 p3IB77Ss019597 for ; Mon, 18 Apr 2011 11:07:07 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p3IB769s019595 for freebsd-rc@FreeBSD.org; Mon, 18 Apr 2011 11:07:06 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 18 Apr 2011 11:07:06 GMT Message-Id: <201104181107.p3IB769s019595@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, 18 Apr 2011 11:07:07 -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/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/151063 rc [rc.subr] Verify network link and packet flow before s 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/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 92 problems total. From owner-freebsd-rc@FreeBSD.ORG Mon Apr 18 23:08:06 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id D9B37106566C for ; Mon, 18 Apr 2011 23:08:06 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 65-241-43-5.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 434F7151232; Mon, 18 Apr 2011 23:08:06 +0000 (UTC) Message-ID: <4DACC455.4040603@FreeBSD.org> Date: Mon, 18 Apr 2011 16:08:05 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110319 Thunderbird/3.1.9 MIME-Version: 1.0 To: Garrett Cooper References: <201012272253.oBRMrH7k025331@freefall.freebsd.org> <1232C1B4-DA64-4332-906E-288B8C1E39FE@gmail.com> <4D1A3DFE.8090009@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: multipart/mixed; boundary="------------080904040004030305020202" Cc: "freebsd-rc@FreeBSD.org" , "ggg_mail@inbox.ru" Subject: Finding $pidfile from a conf file (Was: Re: conf/153460: devd(8) cannot be restarted correctly via /etc/rc.d 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: Mon, 18 Apr 2011 23:08:07 -0000 This is a multi-part message in MIME format. --------------080904040004030305020202 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 12/29/2010 03:44, Garrett Cooper wrote: | Yeah, and while I do agree there are some issues with the change. | | For starters, devd.conf does also have a pid-file directive so the | .conf file and the rc script can get out of sync: So it's taken me some time to get back to this, but I think I've got something. The reason that I didn't want to just hack in a quick fix to this particular issue is that I wanted to come up with a more generic solution. We have a non-trivial number of ports that have rolled their own versions of this, so that sounds like it's time for something to be added to rc.subr to me. :) In the (hopefully) attached script is an implementation of get_pidfile_from_conf() that I think works pretty well, along with an example of utilization. I've tested this with the various conf files I could find from base and ports that specify the pid file and so far so good. The implementation example is written the way it is so that it can be used in ports' scripts immediately, even if the feature isn't in the system's rc.subr. Comments are welcome, especially welcome would be testing with your local conf files. I plan to commit this on Friday if no one has a better idea. Doug - -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iQEcBAEBCAAGBQJNrMRVAAoJEFzGhvEaGryE9ksH/0xPj5VX4LgZG3vU4LAwdg1t aCqOFdehpWvdwzsLqhBhJOWeYu8kD+Of9j3/HAW1JU9mBzoDwxYV5Z5xV0psx2mx qUPDh4im6xqXkH4gC7GR84N3j9peaP0gZBq3Z63rB6ujfqaj62WS+X44o/weRTxy SxnPH780lBV9aQ62SoM/U0oL6RXsuUQhyof+LCeZRGZ2wLh3fk5E9IcztgB9z5r8 zYx9pM2broWTvjZIwoqCBgwJDqi8yp57cXM491RGfXhIuTTNzEB88kAedO15leeg VvP8Q/6j2CglU+hbJDoi7LBb3XMep4cJtGmJrr2nzya2lB1bqbUJWdAfwOjnAqI= =Y+Y3 -----END PGP SIGNATURE----- --------------080904040004030305020202 Content-Type: text/plain; name="testpid" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="testpid" #!/bin/sh # get_pidfile_from_conf string file # # Takes a string to search for in the specified file. # Ignores lines with traditional comment characters. # # Example: # if ! pidfile=`get_pidfile_from_conf "string" "file" 2>/dev/null`; then # pidfile='/path/to/default' #fi # get_pidfile_from_conf() { local string file line string="$1" ; file="$2" if [ -z "$string" -o -z "$file" ] || [ ! -s "$file" ]; then err 3 'USAGE: get_pidfile_from_conf string file' fi while read line; do case "$line" in *[#\;]*${string}*) continue ;; *${string}*) break ;; esac done < $file if [ -n "$line" ]; then line=${line#*/} line="/${line%%[\"\;]*}" echo $line else return 1 fi } if ! pidfile=`get_pidfile_from_conf "$1" "$2" 2>/dev/null`; then pidfile='some default' fi echo "pidfile: $pidfile" exit $? --------------080904040004030305020202-- From owner-freebsd-rc@FreeBSD.ORG Thu Apr 21 01:23:51 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 9F5F4106566C for ; Thu, 21 Apr 2011 01:23:51 +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 516B48FC13 for ; Thu, 21 Apr 2011 01:23:51 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvwHABF/r02DaFvO/2dsb2JhbACEUJMujkK2H5EYhHl9BI4k X-IronPort-AV: E=Sophos;i="4.64,248,1301889600"; d="scan'208";a="119045958" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 20 Apr 2011 20:54:23 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 488E5B3F2A for ; Wed, 20 Apr 2011 20:54:23 -0400 (EDT) Date: Wed, 20 Apr 2011 20:54:23 -0400 (EDT) From: Rick Macklem To: rc@freebsd.org Message-ID: <295158163.384370.1303347263226.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <1445044455.384367.1303347258063.JavaMail.root@erie.cs.uoguelph.ca> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_384369_1729044081.1303347263223" X-Originating-IP: [172.17.91.202] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: rc scripts change 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: Thu, 21 Apr 2011 01:23:51 -0000 ------=_Part_384369_1729044081.1303347263223 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hi, I've attached modified versions of mountd and nfsd for /etc/rc.d, plus a new one called nfssrv. These assume that the mountd and nfsd executables have a new option "-o" which forces use of the old nfs server and that the new nfs server is the default. I also need to add: oldnfs_server_enable="NO" to /etc/defaults/rc.conf - is there a preferred place for this? One thing I am not sure about is the REQUIRE: list in mountd. nfsserver and nfssrv essentially load the respective module. They are only used if sysctl variables need to be set and that's actually done by nfsd. (Should they be listed in mountd or nfsd or ???) Could you please review these. Thanks, rick ------=_Part_384369_1729044081.1303347263223-- From owner-freebsd-rc@FreeBSD.ORG Thu Apr 21 11:01:39 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 9D52F106564A for ; Thu, 21 Apr 2011 11:01:39 +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 58B0C8FC13 for ; Thu, 21 Apr 2011 11:01:39 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjkHABIOsE2DaFvO/2dsb2JhbAAxhCCTMI4/iGmrCpB8gSmDUH0Ejis X-IronPort-AV: E=Sophos;i="4.64,251,1301889600"; d="scan'208";a="119078972" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 21 Apr 2011 07:01:38 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 62FACB3F2F for ; Thu, 21 Apr 2011 07:01:38 -0400 (EDT) Date: Thu, 21 Apr 2011 07:01:38 -0400 (EDT) From: Rick Macklem To: rc@freebsd.org Message-ID: <670755416.393334.1303383698298.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.202] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: Subject: Re: patched rc.conf 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: Thu, 21 Apr 2011 11:01:39 -0000 Apparently the attachments got lost. They are here: http://people.freebsd.org/~rmacklem/rc.conf rick From owner-freebsd-rc@FreeBSD.ORG Thu Apr 21 19:39:24 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id A8423106564A for ; Thu, 21 Apr 2011 19:39:24 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 65-241-43-5.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 702861A7D00; Thu, 21 Apr 2011 19:39:23 +0000 (UTC) Message-ID: <4DB087EB.4070901@FreeBSD.org> Date: Thu, 21 Apr 2011 12:39:23 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110319 Thunderbird/3.1.9 MIME-Version: 1.0 To: Garrett Cooper References: <201012272253.oBRMrH7k025331@freefall.freebsd.org> <1232C1B4-DA64-4332-906E-288B8C1E39FE@gmail.com> <4D1A3DFE.8090009@FreeBSD.org> <4DACC455.4040603@FreeBSD.org> In-Reply-To: <4DACC455.4040603@FreeBSD.org> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "freebsd-rc@FreeBSD.org" , "ggg_mail@inbox.ru" Subject: Re: Finding $pidfile from a conf file (Was: Re: conf/153460: devd(8) cannot be restarted correctly via /etc/rc.d 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: Thu, 21 Apr 2011 19:39:24 -0000 Friendly reminder, I plan to commit the get_pidfile_from_conf() I included in the last message tomorrow. So far I've had no feedback about it which I will take as assent. Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-rc@FreeBSD.ORG Thu Apr 21 23:28:42 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 130231065670; Thu, 21 Apr 2011 23:28:42 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id A2D5C8FC0A; Thu, 21 Apr 2011 23:28:41 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id AFC8B1DD7D3; Fri, 22 Apr 2011 01:28:40 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 986481737B; Fri, 22 Apr 2011 01:28:40 +0200 (CEST) Date: Fri, 22 Apr 2011 01:28:40 +0200 From: Jilles Tjoelker To: Doug Barton Message-ID: <20110421232840.GA29218@stack.nl> References: <201012272253.oBRMrH7k025331@freefall.freebsd.org> <1232C1B4-DA64-4332-906E-288B8C1E39FE@gmail.com> <4D1A3DFE.8090009@FreeBSD.org> <4DACC455.4040603@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DACC455.4040603@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Garrett Cooper , "freebsd-rc@FreeBSD.org" , "ggg_mail@inbox.ru" Subject: Re: Finding $pidfile from a conf file (Was: Re: conf/153460: devd(8) cannot be restarted correctly via /etc/rc.d 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: Thu, 21 Apr 2011 23:28:42 -0000 On Mon, Apr 18, 2011 at 04:08:05PM -0700, Doug Barton wrote: > #!/bin/sh > > # get_pidfile_from_conf string file > # > # Takes a string to search for in the specified file. > # Ignores lines with traditional comment characters. > # > # Example: > # if ! pidfile=`get_pidfile_from_conf "string" "file" 2>/dev/null`; then > # pidfile='/path/to/default' > #fi > # > get_pidfile_from_conf() > { > local string file line > > string="$1" ; file="$2" > > if [ -z "$string" -o -z "$file" ] || [ ! -s "$file" ]; then > err 3 'USAGE: get_pidfile_from_conf string file' > fi > > while read line; do > case "$line" in > *[#\;]*${string}*) continue ;; > *${string}*) break ;; > esac > done < $file > > if [ -n "$line" ]; then > line=${line#*/} > line="/${line%%[\"\;]*}" The meaning of this line depends on the version of sh(1). The correct interpretation, used by sh in 9-current and most other shells, is to strip from the first double-quote or semicolon onwards. However, sh in older FreeBSD versions will strip from the first backslash, double-quote or semicolon onwards. If the 9-current behaviour is desired for all FreeBSD versions, use: line=/${line%%[\"\;]*} Perhaps spaces should be treated as a field terminator as well. > echo $line > else > return 1 > fi > } > > if ! pidfile=`get_pidfile_from_conf "$1" "$2" 2>/dev/null`; then This kind of construction invokes the function in a subshell, which is less efficient. Passing the name of a variable to write the result into is more efficient. It is advisable to set up the init script such that work like get_pidfile_from_conf is only done if the service is actually enabled. > pidfile='some default' > fi > echo "pidfile: $pidfile" > exit $? -- Jilles Tjoelker From owner-freebsd-rc@FreeBSD.ORG Fri Apr 22 00:49:22 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 273DB1065679 for ; Fri, 22 Apr 2011 00:49:22 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 65-241-43-5.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id A914B176D98; Fri, 22 Apr 2011 00:49:05 +0000 (UTC) Message-ID: <4DB0D081.6090900@FreeBSD.org> Date: Thu, 21 Apr 2011 17:49:05 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110319 Thunderbird/3.1.9 MIME-Version: 1.0 To: Jilles Tjoelker References: <201012272253.oBRMrH7k025331@freefall.freebsd.org> <1232C1B4-DA64-4332-906E-288B8C1E39FE@gmail.com> <4D1A3DFE.8090009@FreeBSD.org> <4DACC455.4040603@FreeBSD.org> <20110421232840.GA29218@stack.nl> In-Reply-To: <20110421232840.GA29218@stack.nl> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Garrett Cooper , "freebsd-rc@FreeBSD.org" , "ggg_mail@inbox.ru" Subject: Re: Finding $pidfile from a conf file (Was: Re: conf/153460: devd(8) cannot be restarted correctly via /etc/rc.d 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: Fri, 22 Apr 2011 00:49:22 -0000 On 04/21/2011 16:28, Jilles Tjoelker wrote: >> line="/${line%%[\"\;]*}" > > The meaning of this line depends on the version of sh(1). The correct > interpretation, used by sh in 9-current and most other shells, is to > strip from the first double-quote or semicolon onwards. However, sh in > older FreeBSD versions will strip from the first backslash, double-quote > or semicolon onwards. > > If the 9-current behaviour is desired for all FreeBSD versions, use: > line=/${line%%[\"\;]*} I think it's incredibly unlikely that there would actually be a backslash in the text, and even if there was, it should be ok to strip from there. In the almost equally unlikely even that there is a space in the path name of the pid file, I think the quotes are safer, and future-proof. > Perhaps spaces should be treated as a field terminator as well. At least one conf file that I found spells "pid file" with a space, so I don't think that's safe. >> if ! pidfile=`get_pidfile_from_conf "$1" "$2" 2>/dev/null`; then > > This kind of construction invokes the function in a subshell, which is > less efficient. Passing the name of a variable to write the result into > is more efficient. Right, but I was trying to avoid having to use a global if at all possible. My concern being that what's likely to happen is that someone is going to use "pidfile" as the variable to pass in. I suppose what I could do however is change the function to set something ugly/unique like $_pidfile_from_conf and then have the example implementation look like this: if get_pidfile_from_conf string file ; then pidfile="$_pidfile_from_conf" else pidfile="some default" fi FWIW, this would be different from the way that almost all other rc.subr functions that set values work, they use the echo method overwhelmingly. Compare for example set_rcvar() which is used by almost all of the rc.d scripts. (OTOH, one of the reasons I recommend hard-coding the value instead is precisely because of this inefficiency, it adds about 1 full second to the boot time.) I just did a quick test and the subshell version runs 10,000 times in about 5.2 seconds of wall clock time, which even to me seems efficient enough. :) I can do the pass-by-reference version (which admittedly is about 4 times faster) though if you/others feel strongly that it's better to do it that way. > It is advisable to set up the init script such that work like > get_pidfile_from_conf is only done if the service is actually enabled. Of course. I would imagine that people would use this in a start_precmd. That's certainly how I plan to do it in devd and named. Thanks for the review! Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-rc@FreeBSD.ORG Sat Apr 23 10:42:32 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 F0D39106564A; Sat, 23 Apr 2011 10:42:32 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 8616D8FC12; Sat, 23 Apr 2011 10:42:32 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 587271DD75A; Sat, 23 Apr 2011 12:42:30 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 40A9B1737B; Sat, 23 Apr 2011 12:42:30 +0200 (CEST) Date: Sat, 23 Apr 2011 12:42:30 +0200 From: Jilles Tjoelker To: Doug Barton Message-ID: <20110423104230.GA57811@stack.nl> References: <201012272253.oBRMrH7k025331@freefall.freebsd.org> <1232C1B4-DA64-4332-906E-288B8C1E39FE@gmail.com> <4D1A3DFE.8090009@FreeBSD.org> <4DACC455.4040603@FreeBSD.org> <20110421232840.GA29218@stack.nl> <4DB0D081.6090900@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DB0D081.6090900@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Garrett Cooper , "freebsd-rc@FreeBSD.org" , "ggg_mail@inbox.ru" Subject: Re: Finding $pidfile from a conf file (Was: Re: conf/153460: devd(8) cannot be restarted correctly via /etc/rc.d 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: Sat, 23 Apr 2011 10:42:33 -0000 On Thu, Apr 21, 2011 at 05:49:05PM -0700, Doug Barton wrote: > On 04/21/2011 16:28, Jilles Tjoelker wrote: > >> line="/${line%%[\"\;]*}" > > The meaning of this line depends on the version of sh(1). The correct > > interpretation, used by sh in 9-current and most other shells, is to > > strip from the first double-quote or semicolon onwards. However, sh in > > older FreeBSD versions will strip from the first backslash, double-quote > > or semicolon onwards. > > If the 9-current behaviour is desired for all FreeBSD versions, use: > > line=/${line%%[\"\;]*} > I think it's incredibly unlikely that there would actually be a > backslash in the text, and even if there was, it should be ok to strip > from there. Even if there is, it seems bad if this differs between 8.x and 9.x. > In the almost equally unlikely even that there is a space in the path > name of the pid file, I think the quotes are safer, and future-proof. Assignments are not subject to word splitting anyway, so this is not an issue. The only reasons to quote expansions in assignments are paranoia (because in most other contexts they should be quoted to avoid splitting) and "$*" (because POSIX is clear about v="$*" but not about v=$*). If a variable is assigned as it is made local, readonly or exported, that is syntactically not an assignment so quotes are required. Furthermore, note that the line above line=${line#*/} does not have the quotes either. -- Jilles Tjoelker From owner-freebsd-rc@FreeBSD.ORG Sat Apr 23 16:03:33 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 10C85106564A for ; Sat, 23 Apr 2011 16:03:33 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 65-241-43-5.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 3EC7615159F; Sat, 23 Apr 2011 16:03:32 +0000 (UTC) Message-ID: <4DB2F853.3020202@FreeBSD.org> Date: Sat, 23 Apr 2011 09:03:31 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110319 Thunderbird/3.1.9 MIME-Version: 1.0 To: Jilles Tjoelker References: <201012272253.oBRMrH7k025331@freefall.freebsd.org> <1232C1B4-DA64-4332-906E-288B8C1E39FE@gmail.com> <4D1A3DFE.8090009@FreeBSD.org> <4DACC455.4040603@FreeBSD.org> <20110421232840.GA29218@stack.nl> <4DB0D081.6090900@FreeBSD.org> <20110423104230.GA57811@stack.nl> In-Reply-To: <20110423104230.GA57811@stack.nl> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Garrett Cooper , "freebsd-rc@FreeBSD.org" , "ggg_mail@inbox.ru" Subject: Re: Finding $pidfile from a conf file (Was: Re: conf/153460: devd(8) cannot be restarted correctly via /etc/rc.d 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: Sat, 23 Apr 2011 16:03:33 -0000 On 04/23/2011 03:42, Jilles Tjoelker wrote: > On Thu, Apr 21, 2011 at 05:49:05PM -0700, Doug Barton wrote: >> On 04/21/2011 16:28, Jilles Tjoelker wrote: >>>> line="/${line%%[\"\;]*}" > >>> The meaning of this line depends on the version of sh(1). The correct >>> interpretation, used by sh in 9-current and most other shells, is to >>> strip from the first double-quote or semicolon onwards. However, sh in >>> older FreeBSD versions will strip from the first backslash, double-quote >>> or semicolon onwards. > >>> If the 9-current behaviour is desired for all FreeBSD versions, use: >>> line=/${line%%[\"\;]*} > >> I think it's incredibly unlikely that there would actually be a >> backslash in the text, and even if there was, it should be ok to strip >> from there. > > Even if there is, it seems bad if this differs between 8.x and 9.x. So MFC your changes. :) > The only reasons to quote expansions in assignments are paranoia Yeah, I'm Ok with that. FYI, I got this in last night, using the modified pass-by-reference version that I mentioned in my last post (as a result of your suggestion). It turns out that to make this work it's necessary to run the routine to check the pidfile both in start and stop _precmd. That makes sense of course, just thought I'd mention it. I also learned that if you redirect stderr from the function call you miss error messages generated in it, so my example implementation for ports is a little different than what I first posted. See http://www.freebsd.org/cgi/query-pr.cgi?pr=156594 for what I ended up with. Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-rc@FreeBSD.ORG Sat Apr 23 17:13:03 2011 Return-Path: Delivered-To: rc@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 3EA25106566B for ; Sat, 23 Apr 2011 17:13:03 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 65-241-43-5.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 0798514EFC1; Sat, 23 Apr 2011 17:13:02 +0000 (UTC) Message-ID: <4DB3089E.3070304@FreeBSD.org> Date: Sat, 23 Apr 2011 10:13:02 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110319 Thunderbird/3.1.9 MIME-Version: 1.0 To: Rick Macklem References: <295158163.384370.1303347263226.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <295158163.384370.1303347263226.JavaMail.root@erie.cs.uoguelph.ca> X-Enigmail-Version: 1.1.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: rc@freebsd.org Subject: Re: rc scripts change 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: Sat, 23 Apr 2011 17:13:03 -0000 On 04/20/2011 17:54, Rick Macklem wrote: > Hi, > > I've attached modified versions of mountd and nfsd for /etc/rc.d, plus a > new one called nfssrv. These assume that the mountd and nfsd executables > have a new option "-o" which forces use of the old nfs server and that the > new nfs server is the default. Overall the diffs (http://people.freebsd.org/~rmacklem/rc.conf) seem Ok, but see below about nfssrv. > I also need to add: > oldnfs_server_enable="NO" > to /etc/defaults/rc.conf > - is there a preferred place for this? Near the other nfs related stuff. Please don't forget share/man/man5/rc.conf.5 as well. > One thing I am not sure about is the REQUIRE: list in mountd. > nfsserver and nfssrv essentially load the respective module. They are only > used if sysctl variables need to be set and that's actually done by nfsd. > (Should they be listed in mountd or nfsd or ???) It's not a good idea to add single scripts that only have a tiny function, especially if they are only called conditionally (I.e., they contain KEYWORD: nostart). It's preferred to handle these things things in the script that needs them, or if it's necessary in more than one script to add a function to the appropriate .subr (rc, or network). So can you say a little more about what you're trying to accomplish? It's not clear to me why instead of doing this: + if ! sysctl vfs.newnfs >/dev/null 2>&1; then + force_depend nfssrv || return 1 + fi you would not just do this: + if ! sysctl vfs.newnfs >/dev/null 2>&1; then + load_kld nfsd + fi And finally a meta-note, I admire that you are at least checking for success on your commands, but FYI rather than relying on return it's helpful to use either warn for advisories or err for fatal errors to provide more information about why things are failing. You can read up on these in the comments in /etc/rc.subr, and/or look in /etc/rc.d for examples of how they are used. hth, Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-rc@FreeBSD.ORG Sat Apr 23 21:34:37 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 A07F71065670 for ; Sat, 23 Apr 2011 21:34:37 +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 564088FC12 for ; Sat, 23 Apr 2011 21:34:37 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEAK1Es02DaFvO/2dsb2JhbACET6IQiHCoPo9rgSmDUH0EjjU X-IronPort-AV: E=Sophos;i="4.64,259,1301889600"; d="scan'208";a="119298724" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 23 Apr 2011 17:34:36 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 5DDCAB3EB1; Sat, 23 Apr 2011 17:34:36 -0400 (EDT) Date: Sat, 23 Apr 2011 17:34:36 -0400 (EDT) From: Rick Macklem To: Doug Barton Message-ID: <1881889748.477841.1303594476291.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <4DB3089E.3070304@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.203] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: rc@freebsd.org Subject: Re: rc scripts change 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: Sat, 23 Apr 2011 21:34:37 -0000 > > So can you say a little more about what you're trying to accomplish? > It's not clear to me why instead of doing this: > > + if ! sysctl vfs.newnfs >/dev/null 2>&1; then > + force_depend nfssrv || return 1 > + fi > > you would not just do this: > > + if ! sysctl vfs.newnfs >/dev/null 2>&1; then > + load_kld nfsd > + fi > Well, I know diddly squat (a technical term:-) about shell programming. The above was just cribbed from what it already did for the regular NFS server using "nfsserver". (As far as I know, the only purpose of "nfsserver" is to make sure the module is loaded. It might have been done before the mountd and nfsd daemons knew to load the module, as required. I'll try the load_kld version.) > And finally a meta-note, I admire that you are at least checking for > success on your commands, but FYI rather than relying on return it's > helpful to use either warn for advisories or err for fatal errors to > provide more information about why things are failing. You can read up > on these in the comments in /etc/rc.subr, and/or look in /etc/rc.d for > examples of how they are used. > Ok, I'll take a look. (Again, I was just cribbing what was already there.) Thanks, rick From owner-freebsd-rc@FreeBSD.ORG Sat Apr 23 21:58:54 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 425AF106564A; Sat, 23 Apr 2011 21:58:54 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id CB1998FC08; Sat, 23 Apr 2011 21:58:53 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 342471DD649; Sat, 23 Apr 2011 23:58:53 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 298491737B; Sat, 23 Apr 2011 23:58:53 +0200 (CEST) Date: Sat, 23 Apr 2011 23:58:53 +0200 From: Jilles Tjoelker To: Doug Barton Message-ID: <20110423215853.GA62363@stack.nl> References: <201012272253.oBRMrH7k025331@freefall.freebsd.org> <1232C1B4-DA64-4332-906E-288B8C1E39FE@gmail.com> <4D1A3DFE.8090009@FreeBSD.org> <4DACC455.4040603@FreeBSD.org> <20110421232840.GA29218@stack.nl> <4DB0D081.6090900@FreeBSD.org> <20110423104230.GA57811@stack.nl> <4DB2F853.3020202@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DB2F853.3020202@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Garrett Cooper , "freebsd-rc@FreeBSD.org" , "ggg_mail@inbox.ru" Subject: Re: MFCing sh(1) substitution changes (was: Finding $pidfile from a conf file) 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: Sat, 23 Apr 2011 21:58:54 -0000 On Sat, Apr 23, 2011 at 09:03:31AM -0700, Doug Barton wrote: > On 04/23/2011 03:42, Jilles Tjoelker wrote: > > On Thu, Apr 21, 2011 at 05:49:05PM -0700, Doug Barton wrote: > >> On 04/21/2011 16:28, Jilles Tjoelker wrote: > >>>> line="/${line%%[\"\;]*}" > > > >>> The meaning of this line depends on the version of sh(1). The correct > >>> interpretation, used by sh in 9-current and most other shells, is to > >>> strip from the first double-quote or semicolon onwards. However, sh in > >>> older FreeBSD versions will strip from the first backslash, double-quote > >>> or semicolon onwards. > > > >>> If the 9-current behaviour is desired for all FreeBSD versions, use: > >>> line=/${line%%[\"\;]*} > > > >> I think it's incredibly unlikely that there would actually be a > >> backslash in the text, and even if there was, it should be ok to strip > >> from there. > > > > Even if there is, it seems bad if this differs between 8.x and 9.x. > So MFC your changes. :) Hmm, I think that is a good reason not to MFC them, not a reason to MFC them. If you write something that differs between 8.x and 9.x, although it is very unlikely to have practical consequences, I can imagine that there are scripts where it actually matters and that will break with the 9.x behaviour. If so, I'd prefer that the breakage is noticed on a major FreeBSD version upgrade and not on a minor version upgrade. -- Jilles Tjoelker From owner-freebsd-rc@FreeBSD.ORG Sat Apr 23 22:14:32 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 48E41106564A; Sat, 23 Apr 2011 22:14:32 +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 DBC6E8FC14; Sat, 23 Apr 2011 22:14:31 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEABNOs02DaFvO/2dsb2JhbACET6IQiHCoKY9tgSmDUH0EjjU X-IronPort-AV: E=Sophos;i="4.64,259,1301889600"; d="scan'208";a="119300277" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 23 Apr 2011 18:14:31 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 18FE3B3F90; Sat, 23 Apr 2011 18:14:31 -0400 (EDT) Date: Sat, 23 Apr 2011 18:14:31 -0400 (EDT) From: Rick Macklem To: Doug Barton Message-ID: <1650871661.478247.1303596871007.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <4DB3089E.3070304@FreeBSD.org> 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: rc@freebsd.org Subject: Re: rc scripts change 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: Sat, 23 Apr 2011 22:14:32 -0000 > > So can you say a little more about what you're trying to accomplish? > It's not clear to me why instead of doing this: > > + if ! sysctl vfs.newnfs >/dev/null 2>&1; then > + force_depend nfssrv || return 1 > + fi > > you would not just do this: > > + if ! sysctl vfs.newnfs >/dev/null 2>&1; then > + load_kld nfsd > + fi > Ok, I just tried this and it didn't work. I don't know why? The kld_load doesn't complain about failure and when I check after it's booted, the module is loaded. However, the sysctls complain about unknown oid, so it isn't loaded in time for them, maybe? (Anyway, the nfssrv trick seems to work.) rick From owner-freebsd-rc@FreeBSD.ORG Sat Apr 23 22:40:34 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 EB26D106564A; Sat, 23 Apr 2011 22:40:34 +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 8CA6B8FC13; Sat, 23 Apr 2011 22:40:34 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEABhVs02DaFvO/2dsb2JhbACET6IQiHCoK49qgSmDUH0EjjU X-IronPort-AV: E=Sophos;i="4.64,259,1301889600"; d="scan'208";a="119301375" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 23 Apr 2011 18:40:24 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 6EAACB3F3E; Sat, 23 Apr 2011 18:40:24 -0400 (EDT) Date: Sat, 23 Apr 2011 18:40:24 -0400 (EDT) From: Rick Macklem To: Doug Barton Message-ID: <1308036720.478939.1303598424273.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <4DB3089E.3070304@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.202] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - IE7 (Win)/6.0.10_GA_2692) Cc: rc@freebsd.org Subject: Re: rc scripts change 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: Sat, 23 Apr 2011 22:40:35 -0000 > > > One thing I am not sure about is the REQUIRE: list in mountd. > > nfsserver and nfssrv essentially load the respective module. They > > are only > > used if sysctl variables need to be set and that's actually done by > > nfsd. > > (Should they be listed in mountd or nfsd or ???) > > It's not a good idea to add single scripts that only have a tiny > function, especially if they are only called conditionally (I.e., they > contain KEYWORD: nostart). It's preferred to handle these things > things > in the script that needs them, or if it's necessary in more than one > script to add a function to the appropriate .subr (rc, or network). > > So can you say a little more about what you're trying to accomplish? > It's not clear to me why instead of doing this: > > + if ! sysctl vfs.newnfs >/dev/null 2>&1; then > + force_depend nfssrv || return 1 > + fi > > you would not just do this: > > + if ! sysctl vfs.newnfs >/dev/null 2>&1; then > + load_kld nfsd > + fi > Well, the intent of the above was to get the module loaded so that sysctl could manipulate its sysctl variables. I played with it a bit and it turns out that neither of the above code snippets work in the sense that they don't affect the outcome. What is needed to make the sysctls work is "nfssrv" has to be in the REQUIRED: list for either mountd or nfsd. Without it, the sysctls fail with unknown oid. (I'm guessing there is some delay between the load_kld and when the module gets its sysctl variables registered?) Now, I'm not sure whether there is any advantage to specifying "nfssrv" in nfsd or mountd, although both seem to work when I test them. "nfsserver" is in mountd, so unless you guys have a better suggestion, that's where I'll leave it. rick