[dovecot/f16] fix network still not ready race condition (#871623)

Michal Hlavinka mhlavink at fedoraproject.org
Tue Nov 13 09:51:38 UTC 2012


commit 0043745305e9347617f480d53a2e0599fd35b98a
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Tue Nov 13 10:51:30 2012 +0100

    fix network still not ready race condition (#871623)

 dovecot-2.1.10-waitonline.patch |   11 +++++++++++
 dovecot.spec                    |   13 ++++++++++++-
 prestartscript                  |    3 +++
 3 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/dovecot-2.1.10-waitonline.patch b/dovecot-2.1.10-waitonline.patch
new file mode 100644
index 0000000..324094c
--- /dev/null
+++ b/dovecot-2.1.10-waitonline.patch
@@ -0,0 +1,11 @@
+diff -up dovecot-2.1.10/dovecot.service.in.waitonline dovecot-2.1.10/dovecot.service.in
+--- dovecot-2.1.10/dovecot.service.in.waitonline	2012-11-08 17:09:14.025772652 +0100
++++ dovecot-2.1.10/dovecot.service.in	2012-11-08 17:10:06.472155786 +0100
+@@ -4,6 +4,7 @@ After=local-fs.target network.target
+ 
+ [Service]
+ Type=simple
++ExecStartPre=/usr/libexec/dovecot/prestartscript
+ ExecStart=@sbindir@/dovecot -F
+ ExecReload=/bin/kill -HUP $MAINPID
+ PrivateTmp=true
diff --git a/dovecot.spec b/dovecot.spec
index f18678f..59fa2f1 100644
--- a/dovecot.spec
+++ b/dovecot.spec
@@ -2,7 +2,7 @@ Summary: Secure imap and pop3 server
 Name: dovecot
 Epoch: 1
 Version: 2.0.21
-Release: 2%{?dist}
+Release: 3%{?dist}
 #dovecot itself is MIT, a few sources are PD, pigeonhole is LGPLv2
 License: MIT and LGPLv2
 Group: System Environment/Daemons
@@ -28,6 +28,10 @@ Patch3: dovecot-1.0.rc7-mkcert-paths.patch
 Patch4: dovecot-2.0.21-postreleasefixes.patch
 Patch5: dovecot-2.1.10-reload.patch
 
+#wait for network
+Patch6: dovecot-2.1.10-waitonline.patch
+Source15: prestartscript
+
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: openssl-devel, pam-devel, zlib-devel, bzip2-devel, libcap-devel
 BuildRequires: libtool, autoconf, automake, pkgconfig
@@ -111,6 +115,7 @@ This package provides the development files for dovecot.
 %patch3 -p1 -b .mkcert-paths
 %patch4 -p1 -b .postreleasefixes
 %patch5 -p1 -b .reload
+%patch6 -p1 -b .waitonline
 
 %build
 #required for fdpass.c line 125,190: dereferencing type-punned pointer will break strict-aliasing rules
@@ -177,6 +182,9 @@ install -p -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/dovecot
 #install man pages
 install -p -D -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_mandir}/man5/dovecot.conf.5
 
+#install waitonline script
+install -p -D -m 755 %{SOURCE15} $RPM_BUILD_ROOT%{_libexecdir}/dovecot/prestartscript
+
 # generate ghost .pem files
 mkdir -p $RPM_BUILD_ROOT%{ssldir}/certs
 mkdir -p $RPM_BUILD_ROOT%{ssldir}/private
@@ -407,6 +415,9 @@ make check
 %{_libdir}/%{name}/dict/libdriver_pgsql.so
 
 %changelog
+* Mon Nov 12 2012 Michal Hlavinka <mhlavink at redhat.com> - 1:2.0.21-3
+- fix network still not ready race condition (#871623)
+
 * Fri Nov 02 2012 Michal Hlavinka <mhlavink at redhat.com> - 1:2.0.21-2
 - add reload command to service file
 
diff --git a/prestartscript b/prestartscript
new file mode 100644
index 0000000..e4824e0
--- /dev/null
+++ b/prestartscript
@@ -0,0 +1,3 @@
+#!/bin/sh
+/bin/systemctl -q is-enabled NetworkManager.service && /usr/bin/nm-online -q --timeout 30 ||:
+


More information about the scm-commits mailing list