rc.subr, 1.34.2.22, breaks amd_map_program="ypcat -k amd.master" in RELENG_6

John E Hein jhein at timing.com
Thu Oct 18 09:26:44 PDT 2007


I use amd with nis.
My rc.conf settings are:

amd_enable=YES
amd_map_program="ypcat -k amd.master"

Output of ypcat -k amd.master looks like so:

/foo amd.foo
/bar amd.bar
/baz amd.baz

I was running RELENG_6 from early July.
But I just updated to yesterday's RELENG_6.

Now upon running /etc/rc.d/amd start, I get:

eval: /bar: Permission denied
eval: /baz: Permission denied

And the /var/run/amd.pid is empty (explained below).

The reason is that the rc_flags has line breaks in it
and the new rc.subr no longer converts them to spaces.

If you put set | grep -A 10 rc_flags in /etc/rc.d/amd
after this line:

                rc_flags="${rc_flags} `eval ${amd_map_program}`"

... you will see something like this:

rc_flags='-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map /foo amd.foo
/bar amd.bar
/baz amd.baz'


Later the -p ${rc_flags} > /var/run/amd.pid 2> /dev/null is
tacked on, putting "> ..." it's own separate line.  This
explains why /var/run/amd.pid is empty.

When using 1.34.2.22 (MFC of 1.72, 2007/08/17, committed by yar from
conf/98734), it fails with the described behavior.  Using 1.34.2.21
(2007/07/12), it works fine.  Something in the .22 commit causes the
newlines to not get converted to plain spaces.


I have not yet attempted to narrow down what in .22 (+198 -146)
actually changes the behavior, but the following works around the
problem by converting the newlines to spaces:

Index: amd
===================================================================
RCS file: /base/FreeBSD-CVS/src/etc/rc.d/amd,v
retrieving revision 1.15.2.3
diff -u -p -r1.15.2.3 amd
--- amd	22 Oct 2006 20:33:10 -0000	1.15.2.3
+++ amd	18 Oct 2007 15:57:34 -0000
@@ -34,7 +34,7 @@ amd_precmd()
 	[Nn][Oo] | '')
 		;;
 	*)
-		rc_flags="${rc_flags} `eval ${amd_map_program}`"
+		rc_flags="${rc_flags} `echo $(eval ${amd_map_program})`"
 		;;
 	esac


More information about the freebsd-rc mailing list