commit f83f86db6d6e4c483fb830967175a946b0bcdacc Author: CentOS Sources Date: Tue Nov 3 22:09:05 2020 +0000 import timedatex-0.5-3.el8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b3595f5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/timedatex-0.5.tar.gz diff --git a/.timedatex.metadata b/.timedatex.metadata new file mode 100644 index 0000000..196675d --- /dev/null +++ b/.timedatex.metadata @@ -0,0 +1 @@ +dee8173075f3972e5cdf1b2f3b35a9b9aa2e793a SOURCES/timedatex-0.5.tar.gz diff --git a/SOURCES/timedatex-timeout.patch b/SOURCES/timedatex-timeout.patch new file mode 100644 index 0000000..a380b8d --- /dev/null +++ b/SOURCES/timedatex-timeout.patch @@ -0,0 +1,66 @@ +commit 3f0b85db1d4eedd3fdc9db0832e114215812d15c +Author: Miroslav Lichvar +Date: Wed Jan 10 15:55:05 2018 +0100 + + don't remove timeout after each main context iteration + + With glib2-2.54.3 adding a new timeout causes g_main_context_iteration() + to immediately return FALSE, which triggered an infinite loop removing + and adding the timeout. + + Instead of removing the timeout after all iterations, use a flag to + remove the timeout only when a valid call was handled. + + This fixes issue #4. + +diff --git a/timedatex.c b/timedatex.c +index 28e562c..e671bb5 100644 +--- a/timedatex.c ++++ b/timedatex.c +@@ -120,7 +120,7 @@ struct hwclock_call { + + /* Global variables */ + static GDBusProxy *systemd_proxy, *polkit_proxy; +-static gboolean main_quit, running_auth_checks; ++static gboolean main_quit, running_auth_checks, had_activity; + static GArray *ntp_units; + + +@@ -948,6 +948,8 @@ static void handle_method_call(GDBusConnection *connection, const gchar *caller, + } else { + g_assert_not_reached(); + } ++ ++ had_activity = TRUE; + } + + static const GDBusInterfaceVTable interface_vtable = { +@@ -1022,19 +1024,24 @@ int main(int argc, char **argv) { + read_ntp_units(); + + main_quit = FALSE; ++ had_activity = FALSE; + + /* This is the main loop. Quit when idle for QUIT_TIMEOUT seconds. */ + + while (!main_quit) { + /* Add timeout when not waiting for an authorization check */ +- if (!running_auth_checks) ++ if (!timeout_id && !running_auth_checks) + timeout_id = g_timeout_add(QUIT_TIMEOUT * 1000, stop_main_loop, NULL); + + g_main_context_iteration(g_main_context_default(), TRUE); + +- if (timeout_id) +- g_source_remove(timeout_id); +- timeout_id = 0; ++ if (had_activity || running_auth_checks) { ++ had_activity = FALSE; ++ ++ if (timeout_id) ++ g_source_remove(timeout_id); ++ timeout_id = 0; ++ } + } + + ret = 0; diff --git a/SPECS/timedatex.spec b/SPECS/timedatex.spec new file mode 100644 index 0000000..486adb1 --- /dev/null +++ b/SPECS/timedatex.spec @@ -0,0 +1,96 @@ +%global _hardened_build 1 + +Name: timedatex +Version: 0.5 +Release: 3%{?dist} +Summary: D-Bus service for system clock and RTC settings + +Group: System Environment/Daemons +License: GPLv2+ +URL: https://github.com/mlichvar/timedatex +Source0: https://github.com/mlichvar/timedatex/archive/v%{version}/%{name}-%{version}.tar.gz + +BuildRequires: glib2-devel libselinux-devel systemd +Requires: polkit systemd util-linux + +Patch1: timedatex-timeout.patch + +%description +timedatex is a D-Bus service that implements the org.freedesktop.timedate1 +interface. It can be used to read and set the system clock, the real-time clock +(RTC), the system timezone, and enable or disable an NTP client installed on +the system. It is a replacement for the systemd-timedated service. + +%prep +%setup -q +%patch1 -p1 -b .timeout + +%build +make %{?_smp_mflags} \ + CFLAGS="$RPM_OPT_FLAGS" \ + EXTRA_LDFLAGS="%{__global_ldflags}" + +%install +%makeinstall unitdir=%{?buildroot:%{buildroot}}%{_unitdir} + +# mask systemd-timedated service (#1244023) +mkdir -p %{buildroot}%{_sysconfdir}/systemd/system +ln -s /dev/null %{buildroot}%{_sysconfdir}/systemd/system/systemd-timedated.service + +%post +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%doc COPYING NEWS README +%{_sysconfdir}/systemd/system/systemd-timedated.service +%{_sbindir}/%{name} +%{_mandir}/man8/%{name}.8* +%{_unitdir}/%{name}.service +%dir %{_prefix}/lib/systemd/ntp-units.d + +%changelog +* Fri Feb 09 2018 Fedora Release Engineering - 0.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jan 10 2018 Miroslav Lichvar 0.5-2 +- avoid getting stuck in infinite loop with new glib2 (#1450628) + +* Tue Nov 07 2017 Miroslav Lichvar 0.5-1 +- update to 0.5 + +* Thu Aug 03 2017 Fedora Release Engineering - 0.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 0.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 0.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Feb 05 2016 Fedora Release Engineering - 0.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Nov 10 2015 Miroslav Lichvar 0.4-1 +- update to 0.4 (#1279760) + +* Fri Jul 24 2015 Miroslav Lichvar 0.3-3 +- mask systemd-timedated service (#1244023) +- rely on systemd preset in post scriptlet + +* Fri Jun 19 2015 Fedora Release Engineering - 0.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon May 11 2015 Miroslav Lichvar 0.3-1 +- update to 0.3 (#1190377) + +* Wed Jan 21 2015 Miroslav Lichvar 0.2-1 +- update to 0.2 + +* Wed Nov 19 2014 Miroslav Lichvar 0.1-1 +- initial release