Subject: misc/220: no subject (file transmission)
To: None <gnats-admin>
From: Bob Kemp <rsk@ecs.soton.ac.uk>
List: netbsd-bugs
Date: 04/09/1994 15:05:04
>Number:         220
>Category:       misc
>Synopsis:       globbing error in /etc/netstart when no interfaces ($IFS)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (Misc Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr  9 15:05:03 1994
>Originator:     Bob Kemp
>Organization:
	ECS Dept, Southampton Univ, UK
>Release:        -current 05Mar94
>Environment:
System: NetBSD allegory 0.9a ALLEGORY#0 i386


>Description:
	/etc/netstart modifies $IFS to include "." but
	then uses a filename including an explicit "."
	The intention is that (eg)
		/etc/hostname.lo1
	will be broken into
		/etc/hostname lo1
	thus giving the interface and (in /etc/hostname.lo1)
	configuration details.  Nice idea!

	However, if there are no interfaces /bin/sh
	globs it wrongly.  I think what happens is
		set -- `echo /etc/hostname.*`
	expands to
		set -- /etc/hostname.*
	because there are no /etc/hostname.* files
	(hence globbing for echo fails and leaves it unchanged)
	Next, the command is again broken into words and
	becomes
		set -- /etc/hostname *
	which by globbing becomes
		set -- /etc/hostname SAFE aliases aliases.db csh.cshrc csh.login csh.logout daily defaultdomain disktab disktab.ORIG dm.conf dumpdates exports fstab ftpusers gettytab group hosts hosts.equiv hosts.lpd inetd.conf localtime magic mail.rc man.conf master.passwd monthly motd mtree myname namedb netstart netstart.orig newsyslog.conf passwd phones portal.conf printcap protocols pwd.db rc rc.local remote rpc security sendmail.cf services shells spwd.db syslog.conf ttys uucp vntab weekly
	
	Not quite what was wanted :-)

	You can verify it by trying the following script.

		#!/bin/sh
		IFS=".$IFS"
		echo 1 `echo /etc/Zhostname.*`	# original
		echo 2 `echo /etc/Zhostname*`	# suggested change


>How-To-Repeat:
	Run the above script or do
		cd /etc
		mkdir SAFE
		mv /etc/hostname.* SAFE
		fastboot

>Fix:

*** /etc/netstart.orig	Sat Mar 26 12:27:20 1994
--- /etc/netstart	Sat Apr  9 16:12:11 1994
***************
*** 57,63 ****
  (
      tmp="$IFS"
      IFS="$IFS."
!     set -- `echo /etc/hostname.*`
      IFS=$tmp
      unset tmp
  
--- 57,63 ----
  (
      tmp="$IFS"
      IFS="$IFS."
!     set -- `echo /etc/hostname*`
      IFS=$tmp
      unset tmp
  

>Audit-Trail:
>Unformatted:

------------------------------------------------------------------------------