After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 644821 - Debian/Ubuntu time support
Debian/Ubuntu time support
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: plugins
2.91.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2011-03-15 13:14 UTC by Michael Terry
Modified: 2011-05-18 16:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
look at ntpdate too (11.31 KB, patch)
2011-03-16 20:45 UTC, Michael Terry
needs-work Details | Review
Function-oriented version (15.02 KB, patch)
2011-03-21 18:53 UTC, Michael Terry
none Details | Review

Description Michael Terry 2011-03-15 13:14:05 UTC
Hello!  I recently finished patching gnome-settings-daemon to support Debian/Ubuntu style ntp support.

This involved a slight change in how we query/configure ntp as well as support for querying/configuring ntpdate alongside ntpd.  This is useful because in Ubuntu at least, ntpd is not installed by default, but ntpdate is.

So...  How best to craft this patch for you?  I have a modified .c file, but how were you maintainers envisioning supporting multiple distros?  #ifdefs, runtime querying, some sort of extensible plugin system?
Comment 1 Bastien Nocera 2011-03-15 13:15:59 UTC
Run-time is best, thanks.
Comment 2 Michael Terry 2011-03-15 13:22:31 UTC
Ah, yes.  I see you already have some of Debian detection.  Hadn't looked at trunk in a bit.  OK, will work on further patch for ntpdate support.
Comment 3 Michael Terry 2011-03-16 20:45:33 UTC
Created attachment 183570 [details] [review]
look at ntpdate too

This patch configures Debian/Ubuntu's use of ntpdate too.  If enabling ntp, both ntpd and ntpdate are turned on (ntpdate via if-up.d script).  If disabling, both are turned off.  If either is active, ntp is reported as 'on'.

The diff is a bit complicated because I had to rework the flow a bit so that errors in enabling or the inability to enable one didn't affect the other.
Comment 4 Bastien Nocera 2011-03-16 23:41:32 UTC
That looks wrong. You can't have ntpdate *and* ntpd running at the same time. If ntpdate is the one that's installed by default, then we should enable just ntpdate, otherwise just ntpd.

In fact, ntpdate is a one-shot application, whereas ntpd is a daemon. When ntpd is running, ntpdate can't be run.
Comment 5 Michael Terry 2011-03-17 12:32:49 UTC
In Debian, ntpdate installs an if-up.d script that runs ntpdate whenever an Internet connection comes up.  This script pauses ntpd if it's running.

That is, Debian has two completely independent ways to sync with Internet time using ntp, and both need to be turned on or off together.

Ubuntu installs ntpdate by default, not ntpd.  Though the user can easily install ntpd and have both enabled.

So when a user says "I want manual time", if either nptd or the ntpdate if-up.d script is still active, obviously, they won't really get manual time.
Comment 6 Bastien Nocera 2011-03-21 03:10:24 UTC
Review of attachment 183570 [details] [review]:

I can't see any gross errors in the patch, but the code could really do with being split up into functions. Also, do you really want to return errors if ntpd is correctly enabled, but not ntpdate?
Comment 7 Michael Terry 2011-03-21 16:21:56 UTC
I think it's appropriate as long as the error is from actually trying to enable ntpdate, but not if ntpdate isn't installed in the first place.  But I don't feel strongly about it.

I'll work on a function-oriented version.
Comment 8 Michael Terry 2011-03-21 18:53:35 UTC
Created attachment 183977 [details] [review]
Function-oriented version

How's this?
Comment 9 Bastien Nocera 2011-04-28 14:47:48 UTC
Michael, I've split the code so that all the distribution specific code lives in separate files (which I think is much cleaner).

Once you've updated your patch to make use of the split files, you can commit your changes on the master branch as you wish (as long as you're only making trivial changes to the main file, for example adding a check for Ubuntu's release file).
Comment 10 Michael Terry 2011-04-29 12:32:50 UTC
K, will gladly do so, but not for over a week as I'm going on vacation.  Just FYI.
Comment 11 Michael Terry 2011-05-18 16:43:30 UTC
commit 2958ce3f9035e3dc158d4390c63e4e9415296aee
Author: Michael Terry <michael.terry@canonical.com>
Date:   Wed May 18 12:41:58 2011 -0400

    datetime: Fix ntp logic on Debian to include ntpdate as well as ntpd
    
    https://bugzilla.gnome.org/show_bug.cgi?id=644821
Comment 12 Bastien Nocera 2011-05-18 16:57:26 UTC
(In reply to comment #11)
> commit 2958ce3f9035e3dc158d4390c63e4e9415296aee
> Author: Michael Terry <michael.terry@canonical.com>
> Date:   Wed May 18 12:41:58 2011 -0400
> 
>     datetime: Fix ntp logic on Debian to include ntpdate as well as ntpd
> 
>     https://bugzilla.gnome.org/show_bug.cgi?id=644821

FWIW, it's likely that that portion of code will go away, to be replaced by a D-Bus interface provided by systemd. I would certainly expect systemd not being required as the init system for this to work, so it would just be another package to include.
Comment 13 Michael Terry 2011-05-18 16:59:01 UTC
Sure, I've been reading that systemd thread with interest too.  :)

But presumably this code can just be moved into whatever dbus daemon gets created for it and not rewritten again.