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/