Linux Archive

Linux Archive (
-   CentOS (
-   -   Bug in dhclient-script for ntp.conf in Centos 5? (

Stephen Harris 06-17-2008 02:19 PM

Bug in dhclient-script for ntp.conf in Centos 5?
I dunno if this is upstream or not since I don't have any RHEL5

% rpm -qf /sbin/dhclient-script

This section of code appears to have a bug (around line 411)

elif [ -n "$new_ntp_servers" ] && [ -e /etc/ntp.conf ]; then
save_previous /etc/ntp.conf
/bin/egrep -v '(^[ ]*(server|fudge))|(generated by /sbin/dhclient-script)'< /etc/ntp.conf.predhclient > /etc/ntp.conf
echo '# servers generated by /sbin/dhclient-script' >> /etc/ntp.conf
localClocks=(`/bin/egrep '^[ ]*server[ ]+127.127' /etc/ntp.conf.predhclient | while read s addr rest; do echo $addr; done`)
localClockFudge="`/bin/egrep '^[ ]*fudge[ ]+127.127' /etc/ntp.conf.predhclient`";
for s in $new_ntp_servers ${localClocks[@]};
echo 'server '$s >> /etc/ntp.conf;
echo "$localClockFudge" >> /etc/ntp.conf;
if [ -x /usr/bin/diff ] && /usr/bin/diff -q /etc/ntp.conf /etc/ntp.conf.predhclient >/dev/null 2>&1; then
: ;
/sbin/service ntpd condrestart >/dev/null 2>&1

The problem is that if there are no "fudge' lines in the existing ntp.conf
then localClockFudge will be empty, and this will cause a blank line
to be appended to the end of the new ntp.conf; diff will then think the
file has changed and so ntpd will be restarted. Over time a large
number of blank lines will be prepended to the ntp.conf because of the
initial egrep statement.


CentOS mailing list

All times are GMT. The time now is 05:45 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.