Subject: bin/23305: rc.d/ntpdate ntp.conf parse error
To: None <gnats-bugs@gnats.netbsd.org>
From: None <wolfgang@wsrcc.com>
List: netbsd-bugs
Date: 10/29/2003 08:16:15
>Number:         23305
>Category:       bin
>Synopsis:       rc.d/ntpdate ntp.conf parse error
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 29 16:17:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang S. Rupprecht
>Release:        NetBSD 1.6ZE
>Organization:
W S Rupprecht Computer Consulting, Fremont CA
>Environment:
	
	
System: NetBSD capsicum.wsrcc.com 1.6ZE NetBSD 1.6ZE (WSRCC_ATHLON) #1: Mon Oct 27 22:04:45 PST 2003 wolfgang@capsicum.wsrcc.com:/var/obj/netbsd/sys/arch/i386/compile/WSRCC_ATHLON i386
Architecture: i386
Machine: i386
>Description:

	/etc/rc.d/ntpdate can't reliably parse a fairly standard
	ntp.conf file.

>How-To-Repeat:
	

Replace /etc/ntp.conf with this:

# look mom no hands!
server random-server.example.com # random comment
fudge  127.127.1.0 stratum 10
server another-random-server.example.com # more 
# end more comments
	
Run "/etc/rc.d/ntpdate start"

watch the off-the-wall gripes about not finding host "#"

>Fix:

I *think* this is what was intended:

diff -u /etc/rc.d/ntpdate.\~1\~ /etc/rc.d/ntpdate
--- /etc/rc.d/ntpdate.~1~	2003-10-23 10:29:38.000000000 -0700
+++ /etc/rc.d/ntpdate	2003-10-29 08:00:13.000000000 -0800
@@ -20,7 +20,7 @@
 		ntpdate_hosts=`awk '
 			/^#/				{ next }
 			/^(server|peer)[ \t]*127.127/	{ next }
-			/^(server|peer)/		{ if ($2 ~ /[-]/)
+			/^(server|peer)/		{ if ($2 ~ /^-/)
 							    print $3
 							  else
 							    print $2 }


>Release-Note:
>Audit-Trail:
>Unformatted: