Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jun 2012 00:11:40 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        wblock@wonkity.com (Warren Block)
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   Re: devd problem with 9-stable
Message-ID:  <201206152211.q5FMBef0092765@lurza.secnetix.de>
In-Reply-To: <alpine.BSF.2.00.1206151250140.27941@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206152211.q5FMBef0092765>