devd problem with 9-stable
Oliver Fromme
olli at lurza.secnetix.de
Fri Jun 15 22:11:57 UTC 2012
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
More information about the freebsd-stable
mailing list