From owner-freebsd-stable@FreeBSD.ORG Fri Jun 15 22:11:57 2012 Return-Path: Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BEE1F1065673 for ; Fri, 15 Jun 2012 22:11:57 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 3B72D8FC18 for ; Fri, 15 Jun 2012 22:11:57 +0000 (UTC) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id q5FMBebT092767; Sat, 16 Jun 2012 00:11:55 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id q5FMBef0092765; Sat, 16 Jun 2012 00:11:40 +0200 (CEST) (envelope-from olli) From: Oliver Fromme Message-Id: <201206152211.q5FMBef0092765@lurza.secnetix.de> To: wblock@wonkity.com (Warren Block) Date: Sat, 16 Jun 2012 00:11:40 +0200 (CEST) In-Reply-To: X-Mailer: ELM [version 2.5 PL8] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (lurza.secnetix.de [127.0.0.1]); Sat, 16 Jun 2012 00:11:55 +0200 (CEST) Cc: freebsd-stable@FreeBSD.ORG Subject: Re: devd problem with 9-stable X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 22:11:57 -0000 Warren Block wrote: > On Fri, 15 Jun 2012, Oliver Fromme wrote: > > You can try to prepend a backslash, i.e. echo \$devnum. This > > isn't documented, but then again, using backslashes to continue > > strings that span multiple lines isn't documented either. > > devd has already expanded variables by then: > Executing 'devnum=ugen0.6 && echo devnum: \ > /tmp/example && echo cdev: ugen0.6 >> /tmp/example' I see ... The next thing I would've tried is to double the dollar signs, like in Makefiles, i.e. $$devnum. But it seems you already found a different way: > It does seem to work to use the bracketed form: > > action "devnum=`echo $cdev | sed -e 's/^ugen//'` && echo ${devnum} > /tmp/example"; Ok. > I started to enter a PR, but got confused partway through. The problem > here is that devd is expanding variables unknown to it in action strings > (unless the bracket notation is used), and replacing them with empty > strings. Agreed? Yes, that's what seems to happen. At the very least, this behaviour should be documented in the manual page. In particular, I'm worried that the work- around (i.e. using brackets) might work just by "accident", i.e. it's not guarateed that it will work in the future. There *should* be a way to quote or escape dollar signs so devd does not expand them, whether the variable name is known to it or not, and this way *should* be documented in the manual page. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "C++ is over-complicated nonsense. And Bjorn Shoestrap's book a danger to public health. I tried reading it once, I was in recovery for months." -- Cliff Sarginson