From 59f2847b9bf897a5513e4e3e7462d1b6207cba617a01518dcbd406aa258b9db5 Mon Sep 17 00:00:00 2001 From: Robert Schweikert Date: Mon, 13 Jun 2016 13:10:49 +0000 Subject: [PATCH] Accepting request 401599 from home:jgleissner:branches:Cloud:Tools fixed potential broken pipe error message when executing user script (bsc#903449) OBS-URL: https://build.opensuse.org/request/show/401599 OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=42 --- cloud-init-python2-sigpipe.patch | 22 ++++++++++++++++++++++ cloud-init.changes | 6 ++++++ cloud-init.spec | 3 +++ 3 files changed, 31 insertions(+) create mode 100644 cloud-init-python2-sigpipe.patch diff --git a/cloud-init-python2-sigpipe.patch b/cloud-init-python2-sigpipe.patch new file mode 100644 index 0000000..2a6858e --- /dev/null +++ b/cloud-init-python2-sigpipe.patch @@ -0,0 +1,22 @@ +Index: cloud-init-0.7.6/cloudinit/util.py +=================================================================== +--- cloud-init-0.7.6.orig/cloudinit/util.py ++++ cloud-init-0.7.6/cloudinit/util.py +@@ -59,6 +59,7 @@ from cloudinit import version + + from cloudinit.settings import (CFG_BUILTIN) + ++from signal import signal, SIGPIPE, SIG_DFL + + _DNS_REDIRECT_IP = None + LOG = logging.getLogger(__name__) +@@ -1559,7 +1560,8 @@ def subp(args, data=None, rcs=None, env= + stdin = subprocess.PIPE + sp = subprocess.Popen(args, stdout=stdout, + stderr=stderr, stdin=stdin, +- env=env, shell=shell) ++ env=env, shell=shell, ++ preexec_fn=lambda: signal(SIGPIPE, SIG_DFL)) + (out, err) = sp.communicate(data) + except OSError as e: + raise ProcessExecutionError(cmd=args, reason=e) diff --git a/cloud-init.changes b/cloud-init.changes index e17d16c..f749332 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jun 6 09:43:12 UTC 2016 - joachim.gleissner@suse.com + +- Add cloud-init-python2-sigpipe.patch (bsc#903449) + + Restore SIGPIPE default handler when executing shell scripts + ------------------------------------------------------------------- Tue May 3 21:49:47 UTC 2016 - rjschwei@suse.com diff --git a/cloud-init.spec b/cloud-init.spec index c25676a..3e4ff91 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -41,6 +41,8 @@ Patch11: dataSourceOpenNebula.patch Patch12: fix-default-systemd-unit-dir.patch Patch13: no_logic_change.patch Patch14: cloud-init-finalbeforelogin.patch +# python2 disables SIGPIPE, causing broken pipe errors in shell scripts (bsc#903449) +Patch20: cloud-init-python2-sigpipe.patch BuildRequires: fdupes BuildRequires: filesystem BuildRequires: python-devel @@ -141,6 +143,7 @@ Unit tests for the cloud-init tools %patch12 %patch13 %patch14 +%patch20 -p1 %if 0%{?suse_version} <= 1130 # disable ecdsa for SLE 11 (not available)