Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 May 1995 23:50:13 +0200 (MET DST)
From:      Christoph Kukulies <kuku@gilberto.physik.rwth-aachen.de>
To:        rgrimes@gndrsh.aac.dev.com (Rodney W. Grimes)
Cc:        freebsd-current@freefall.cdrom.com (user alias)
Subject:   Re: bug in /usr/src/etc/rc (netstart)
Message-ID:  <199505112150.XAA16952@gilberto.physik.rwth-aachen.de>
In-Reply-To: <199505111725.KAA10530@gndrsh.aac.dev.com> from "Rodney W. Grimes" at May 11, 95 10:25:39 am

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> > 
> > > 
> > > > 
> > > > 
> > > > netstart is started using sh /etc/netstart (that was a . /etc/netstart
> > > > formerly and it used to work). Now, starting it with sh /etc/netstart
> > > > $hostname is unknown and the consequences are quite unfriendly.
> > > 
> > > Hostname should be set by /etc/sysconfig, /etc/sysconfig is .'ed into
> > > /etc/rc.  Infact all variables that where set in /etc/netstart should
> > > now be set by /etc/sysconfig.
> > > 
> > > Do you infact have /etc/sysconfig 1.11, /etc/rc 1.63 ?
> > 
> > I checked again now definitely with both, sysconfig 1.11, rc 1.63 and
> > when I have the sh /etc/netstart in rc the hostname is not being set.
> > How should it ? I don't need to tell you that a sub shell does not inherit
> > variables that are set in the parent unless the subshell is 'sourced'.
> > 
> > It works ok if I replace sh with . (source) (which was in some
> > earlier version of rc anyway).
> 
> I don't like to repeat myself, but ``Hostname is set by /etc/sysconfig,
> /etc/sysconfig is sourced by /etc/rc''.  I know all about sub shell vs
> sourced file and the effects on variables.  I have been writting /etc/rc
> files for 15 years.

I didn't put this in doubt.

> 
> Just where are you setting $hostname at?  If your not doing it at about

Exactly there I'm setting hostname.

> line 61 of /etc/sysconfig your not doing it the right way!!!
> 
> You will note that at line 75 of /etc/rc the file /etc/sysconf is sourced
> into /etc/rc which means $hostname is defined.

$hostname (the variable) is defined for rc but not for netstart and when the
hostname is set by netstart by the /sbin/hostname $hostname, then
hostname *is* empty the way it is being done currently. Excuse me!
I'm well aware of myname and defaultrouter being gone and I don't have them
any longer.

rc sources sysconfig. So rc knows $hostname (the variable).
rc shells netstart but the variable $hostname *is* empty in netstart
where the actual hostname is being set via the hostname $hostname command.


Let's take this little example:

let r be rc
let s be sysconfig
let n bet netstart

-------- r ---------
#!/bin/sh
. s
sh n
-------- s ---------
#!/bin/sh
hostname=foo
-------- n ---------
#!/bin/sh -
echo $hostname

Now execute r and you will find the the echo in n is empty.

A sixpack of beer that something is wrong with the current rc/sysconfig/net
start combo.


> 
> You will also note that this is the same way that /etc/netstart now
> gets this value from /etc/sysconfig.
> 
> -- 
> Rod Grimes                                      rgrimes@gndrsh.aac.dev.com
> Accurate Automation Company                   Custom computers for FreeBSD
> 

--Chris Christoph P. U. Kukulies kuku@gil.physik.rwth-aachen.de
FreeBSD blues.physik.rwth-aachen.de 2.0-BUILT-19950507 FreeBSD 2.0-BUILT-1995
0507 #0: Sun May  7 18:08:05 MET DST 1995     root@blues.physik.rwth-aachen.d
e:/usr/src/sys/compile/BLUESGUS  i386



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