From 106e0b1ebcdacb753faf585562ba45003599d58844bcf8426910d526e09abfbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Schr=C3=B6der?= <mls@suse.com>
Date: Mon, 6 Jun 2011 11:32:31 +0000
Subject: [PATCH] - ignore SIGPIPE when writing to dependency helpers

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=121
---
 buildpipe.diff | 17 +++++++++++++++++
 rpm.changes    |  6 ++++++
 rpm.spec       |  3 ++-
 3 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 buildpipe.diff

diff --git a/buildpipe.diff b/buildpipe.diff
new file mode 100644
index 0000000..5a9066b
--- /dev/null
+++ b/buildpipe.diff
@@ -0,0 +1,17 @@
+--- build/rpmfc.c.orig	2011-06-06 11:27:32.000000000 +0000
++++ build/rpmfc.c	2011-06-06 11:28:47.000000000 +0000
+@@ -165,12 +165,14 @@ static int sigpipe_init(void)
+     fcntl(_sigpipe[1], F_SETFD, (fcntl(_sigpipe[1], F_GETFD)|FD_CLOEXEC));
+     /* XXX SIGPIPE too, but NSPR disables it already, dont mess with it */
+     signal(SIGCHLD, sigpipe_handler); 
++    signal(SIGPIPE, SIG_IGN); 
+     return _sigpipe[0];
+ }
+ 
+ static void sigpipe_finish(void)
+ {
+     signal(SIGCHLD, SIG_DFL); 
++    signal(SIGPIPE, SIG_DFL); 
+     close(_sigpipe[0]);
+     close(_sigpipe[1]);
+     _sigpipe[0] = -1;
diff --git a/rpm.changes b/rpm.changes
index 1adf6ca..c1ae9c3 100644
--- a/rpm.changes
+++ b/rpm.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Mon Jun  6 13:30:05 CEST 2011 - mls@suse.de
+
+- ignore SIGPIPE when writing to dependency helpers, so that
+  builds don't randomly abort when a helper is missing
+
 -------------------------------------------------------------------
 Fri Jun  3 15:19:02 CEST 2011 - mls@suse.de
 
diff --git a/rpm.spec b/rpm.spec
index 269112c..01d1b1a 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -118,6 +118,7 @@ Patch80:        magic_and_path.diff
 Patch81:        safemacro.diff
 Patch82:        emptychangelog.diff
 Patch83:        assumeexec.diff
+Patch84:        buildpipe.diff
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 #
 # avoid bootstrapping problem
@@ -181,7 +182,7 @@ rm -f rpmdb/db.h
 %patch -P 50 -P 51 -P 52 -P 53 -P 54 -P 55 -P 56 -P 57 -P 58 -P 59
 %patch -P 60 -P 61 -P 62 -P 63 -P 64 -P 65 -P 66 -P 67 -P 68 -P 69
 %patch -P 70 -P 71 -P 72 -P 73 -P 74 -P 75 -P 76 -P 77 -P 78 -P 79
-%patch -P 80 -P 81 -P 82 -P 83
+%patch -P 80 -P 81 -P 82 -P 83 -P 84
 #chmod 755 scripts/find-supplements{,.ksyms}
 #chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms
 #chmod 755 scripts/firmware.prov