Stephen Harris
2008-Jun-17 14:19 UTC
[CentOS] 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 dhclient-3.0.5-7.el5 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[@]}; do echo 'server '$s >> /etc/ntp.conf; done 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 : ; else /sbin/service ntpd condrestart >/dev/null 2>&1 fi; fi fi; 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. -- rgds Stephen
Ralph Angenendt
2008-Jun-17 14:49 UTC
[CentOS] Bug in dhclient-script for ntp.conf in Centos 5?
Stephen Harris wrote:> I dunno if this is upstream or not since I don't have any RHEL5<http://bugs.centos.org/view.php?id=2799> and <https://bugzilla.redhat.com/show_bug.cgi?id=450301> Cheers, Ralph -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20080617/4c43aa11/attachment-0002.sig>