Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Mar 2016 17:51:30 +0000
From:      Tim Preston <graywolfe@mac.com>
To:        freebsd-current@freebsd.org
Subject:   Possible problem with the ${name}_chdir variable behaviour in /etc/c.subr
Message-ID:  <F716D683-07B7-4E0A-A51E-75E84D8AB794@mac.com>

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

I was having a problem making the audio/teamspeak3-server port start fro =
the rc.d scripts on a  -current box that I=E2=80=99ve just built. I =
eventually traced this down to it not starting in the correct directory.

Looking at the rc.d script I could see that it was attempting to chdir =
to  the correct directory by setting the teamspeak_chdir variable. So it =
looked like this feature was misbehaving in some way.

To test this I put together an rc.d script for pwd that used =
${name}_chdir based on how the teamspeak rc.d script was setup. Running =
this on a 10.3 box showed that it was changing to the specified =
directory as expected, but on -current it was not.

I=E2=80=99ve taken a quick look at rc.subr on both boxes but I can=E2=80=99=
t immediately see what=E2=80=99s breaking this, and I can=E2=80=99t see =
anything in the setup or behaviour of the -current box that would point =
to it being something that I=E2=80=99ve broken somehow there.

I was wondering if anyone else could reproduce this?


Simple rc.d script for pwd
-----
#!/bin/sh

# PROVIDE: pwd
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name=3D"pwd"
rcvar=3Dpwd_enable

db_dir=3D/var/db/teamspeak

command=3D/bin/pwd
pwd_chdir=3D$db_dir
required_dirs=3D"$db_dir"

load_rc_config $name

: ${pwd_enable=3D"NO"}

run_rc_command "$1"
-----

Running on 10.3 shows the expected result
-----
root@amy:~# uname -a
FreeBSD amy.flibble.org 10.3-BETA3 FreeBSD 10.3-BETA3 #3 r296346: Thu =
Mar  3 15:09:55 GMT 2016     root@amy:/usr/obj/usr/src/sys/GENERIC  =
amd64
root@amy:~# grep FreeBSD /etc/rc.subr =20
# $FreeBSD: stable/10/etc/rc.subr 292450 2015-12-18 19:58:34Z rilles $
root@amy:~# ls -ld /var/db/teamspeak=20
drwxr-xr-x  3 teamspeak  teamspeak  512 Mar 20 00:23 /var/db/teamspeak
root@amy:~# sum /usr/local/etc/rc.d/pwd=20
33073 1 /usr/local/etc/rc.d/pwd

root@amy:~# service pwd onestart
Starting pwd.
/var/db/teamspeak
-----

On -current we see that were still in /
-----
root@emily:~# uname -a
FreeBSD emily.flibble.org 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r297022: =
Fri Mar 18 15:18:44 UTC 2016     =
root@emily.flibble.org:/usr/obj/usr/src/sys/GENERIC  amd64
root@emily:~# grep FreeBSD /etc/rc.subr
# $FreeBSD: head/etc/rc.subr 295949 2016-02-24 01:32:12Z araujo $
root@amy:~# ls -ld /var/db/teamspeak=20
drwxr-xr-x  3 teamspeak  teamspeak  512 Mar 20 00:23 /var/db/teamspeak
root@emily:~# sum /usr/local/etc/rc.d/pwd
33073 1 /usr/local/etc/rc.d/pwd

root@emily:~# service pwd onestart
Starting pwd.
/
-----


--=20
Tim Preston
graywolfe@mac.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F716D683-07B7-4E0A-A51E-75E84D8AB794>