Bug 228424

Summary: ntpd may fail to start if options include both -g and -x
Product: [Fedora] Fedora Reporter: Stephen Casner <casner>
Component: ntpAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-03-16 11:11:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch none

Description Stephen Casner 2007-02-13 01:09:00 UTC
Description of problem:

When -x is included, the /etc/rc.d/init.d/ntpd script will run ntpdate to set
the time before starting ntpd.  In ntpdate fails, then the script will
add a -g option.  If the user-supplied options already include -g, then there
will be two, and consequently ntpd refuses to start (that is new behavior
sometime between 4.2.0 and 4.2.4).

Version-Release number of selected component (if applicable):

ntpd 4.2.4 installed on an FC5 system from ntp-4.2.4-3.i386.rpm built
by me from ntp-4.2.4-3.fc6.src.rpm obtained from Fedora project (hence
I said FC6 as the version for this bug).

How reproducible: easy

Steps to Reproduce:
1. Configure /etc/ntp/step-tickers or server address in
   /etc/ntp.conf to be an unreachable address, and set
   /etc/sysconfig/ntp to:

OPTIONS="-g -x"

2. /etc/rc.d/init.d/ntpd start
  
Actual results:

> /etc/rc.d/init.d/ntpd start
ntpd: Synchronizing with time server:                      [FAILED]
Starting ntpd: ERROR:  only one panicgate option allowed
ntpd - NTP daemon program - Ver. 4.2.4
USAGE:  ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
[snipped usage text]
Options are specified by doubled hyphens and their name
or by a single hyphen and the flag character.

please send bug reports to:  http://bugs.ntp.isc.org, bugs
                                                           [FAILED]

Expected results:

Even though ntpdate will fail, ntpd should start and run, rather than
quitting.  It will complain about the unreachable server, but if the
server later becomes reachable, ntpd will being peering with it.

Additional info:

The fix I recommend is for the /etc/rc.d/init.d/ntpd script to check if there
already is a -g option present before adding one.  Note that there are two
places in the start cause of that script where a -g is added.

Comment 1 Stephen Casner 2007-02-13 01:09:00 UTC
Created attachment 147951 [details]
Proposed patch

Comment 2 Miroslav Lichvar 2007-02-14 14:23:27 UTC
Thanks, will be in next release.

Comment 3 Miroslav Lichvar 2007-03-07 18:57:40 UTC
Fixed in ntp-4.2.4p0-1.fc6.