Subject: misc/19125: etc.default can only be a relative path
To: None <gnats-bugs@gnats.netbsd.org>
From: None <wiz@netbsd.org>
List: netbsd-bugs
Date: 11/21/2002 18:29:00
>Number:         19125
>Category:       misc
>Synopsis:       etc.default can only be a relative path
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 21 10:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Klausner
>Release:        NetBSD 1.6K
>Organization:
	
>Environment:
System: NetBSD klausner.inria.fr 1.6K NetBSD 1.6K (KRAFTLACKEL) #0: Tue Nov 5 23:44:03 CET 2002 wiz@hiro.dynup.net:/disk/archive/cvs/src/sys/arch/macppc/compile/KRAFTLACKEL macppc
Architecture: powerpc
Machine: macppc
>Description:
If /etc/etc.default points to an absolute path (like /etc/etc.network),
then the prompt during boot displays the whole output of
`ls -ld /etc/etc.default` instead of only the part after the dot, which
makes a very awkward prompt:
Which configuration [lrwxr-xr-x  1 root  wheel  9 Nov 20 00:33 /etc/etc.default -> etc.network]?

>How-To-Repeat:
Use newbtconf to create symlink'ed /etc files, if you haven't done
so already.
rm /etc/etc.default
ln -s /etc/etc.network /etc/etc.default

The problem lies in /etc/rc.d/bootconf.sh:

	if [ -h /etc/etc.default ]; then
		def=`ls -ld /etc/etc.default 2>&1`
		default="${def##*-> etc.}"
	else
		default=current
	fi

The pattern in the {} only matches on symlinks.
On the other hand, bootconf.sh has the following code later on:
		rm -f /etc/etc.current
		ln -s /etc/etc.$conf /etc/etc.current
which makes /etc/etc.current an absolute path.

`ls -ld /etc/etc.current` is "parsed" in the same way but not
displayed, except if you have no etc.default symlink.

>Fix:
Fix the shell construct above to accept absolute paths; or
change the code later on to only create relative paths, like
		rm -f /etc/etc.current
		ln -s etc.$conf /etc/etc.current
Don't know which one is preferred.
>Release-Note:
>Audit-Trail:
>Unformatted: