From owner-freebsd-current Thu May 11 14:40:04 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id OAA15285 for current-outgoing; Thu, 11 May 1995 14:40:04 -0700 Received: from campino.informatik.rwth-aachen.de (campino.Informatik.RWTH-Aachen.DE [137.226.225.2]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id OAA15273 for ; Thu, 11 May 1995 14:39:56 -0700 Received: from gilberto.physik.rwth-aachen.de by campino.informatik.rwth-aachen.de (4.1/campino-7) id AA12503; Thu, 11 May 95 23:38:49 +0200 Received: (from kuku@localhost) by gilberto.physik.rwth-aachen.de (8.6.8/8.6.9) id XAA16952; Thu, 11 May 1995 23:50:14 +0200 Message-Id: <199505112150.XAA16952@gilberto.physik.rwth-aachen.de> Subject: Re: bug in /usr/src/etc/rc (netstart) To: rgrimes@gndrsh.aac.dev.com (Rodney W. Grimes) Date: Thu, 11 May 1995 23:50:13 +0200 (MET DST) Cc: freebsd-current@freefall.cdrom.com (user alias) In-Reply-To: <199505111725.KAA10530@gndrsh.aac.dev.com> from "Rodney W. Grimes" at May 11, 95 10:25:39 am From: Christoph Kukulies Reply-To: Christoph Kukulies X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 2934 Sender: current-owner@FreeBSD.org Precedence: bulk > > > > > > > > > > > > > > > > > > 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