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

Michal Hlavinka mhlavink at fedoraproject.org
Mon Nov 12 17:36:48 UTC 2012


commit fdb07b499732d07b39bdf22fb9c7b1721c8bce37
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Mon Nov 12 18:36:42 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 dc8c969..506fd29 100644
--- a/dovecot.spec
+++ b/dovecot.spec
@@ -3,7 +3,7 @@ Name: dovecot
 Epoch: 1
 Version: 2.1.10
 #global prever .rc6
-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
@@ -31,6 +31,10 @@ Patch3: dovecot-1.0.rc7-mkcert-paths.patch
 Patch4: dovecot-2.1.10-reload.patch
 Patch5: dovecot-2.1-privatetmp.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
@@ -120,6 +124,7 @@ This package provides the development files for dovecot.
 %patch4 -p1 -b .reload
 #disable privatetmp for F17- rhbz#843116
 #%patch5 -p1 -b .privatetmp
+%patch6 -p1 -b .waitonline
 sed -i '/DEFAULT_INCLUDES *=/s|$| '"$(pkg-config --cflags libclucene-core)|" src/plugins/fts-lucene/Makefile.in
 
 %build
@@ -196,6 +201,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
@@ -438,6 +446,9 @@ make check
 %{_libdir}/%{name}/dict/libdriver_pgsql.so
 
 %changelog
+* Thu Nov 08 2012 Michal Hlavinka <mhlavink at redhat.com> - 1:2.1.10-3
+- fix network still not ready race condition (#871623)
+
 * Fri Nov 02 2012 Michal Hlavinka <mhlavink at redhat.com> - 1:2.1.10-2
 - add reload command to service file
 - disable PrivateTmp, it does not work (#843116) and it won't 
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