summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2018-09-21 00:36:53 +0200
committerThomas Deutschmann <whissi@gentoo.org>2018-09-21 00:37:15 +0200
commita6b83f082a08073c99ad5e8b0a8564fb30083816 (patch)
tree63cf7ce1d19bc4013b60d2d11a59efe505a05881 /app-admin
parentapp-metrics/prometheus: Version bump to 2.4.1 (diff)
downloadgentoo-a6b83f082a08073c99ad5e8b0a8564fb30083816.tar.gz
gentoo-a6b83f082a08073c99ad5e8b0a8564fb30083816.tar.bz2
gentoo-a6b83f082a08073c99ad5e8b0a8564fb30083816.zip
app-admin/rsyslog: fix omprog-output-capture-mt test when using Py3
Package-Manager: Portage-2.3.49, Repoman-2.3.10
Diffstat (limited to 'app-admin')
-rw-r--r--app-admin/rsyslog/files/rsyslog-8.38.0-fix-omprog-output-capture-mt-test.patch66
-rw-r--r--app-admin/rsyslog/rsyslog-8.38.0.ebuild2
2 files changed, 67 insertions, 1 deletions
diff --git a/app-admin/rsyslog/files/rsyslog-8.38.0-fix-omprog-output-capture-mt-test.patch b/app-admin/rsyslog/files/rsyslog-8.38.0-fix-omprog-output-capture-mt-test.patch
new file mode 100644
index 000000000000..c78e0e502d46
--- /dev/null
+++ b/app-admin/rsyslog/files/rsyslog-8.38.0-fix-omprog-output-capture-mt-test.patch
@@ -0,0 +1,66 @@
+From 0b0a1262f2b401ea16b7d0b36d8254c500cb9d8e Mon Sep 17 00:00:00 2001
+From: Joan Sala <jsiwrk@gmail.com>
+Date: Thu, 20 Sep 2018 22:37:58 +0200
+Subject: [PATCH] testbench: fix incompatibility of one omprog test with
+ Python3
+
+Python3 writes to stderr immediately, and this caused the
+captured output to differ with respect to Python2. Simplified
+the test to do a single write to stderr. Also a cast to int
+was needed when calculating 'numRepeats'.
+
+closes #3030
+---
+ tests/omprog-output-capture-mt.sh | 2 +-
+ .../testsuites/omprog-output-capture-mt-bin.py | 17 +++++++----------
+ 2 files changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/tests/omprog-output-capture-mt.sh b/tests/omprog-output-capture-mt.sh
+index 50f5c6354..080fabd2a 100755
+--- a/tests/omprog-output-capture-mt.sh
++++ b/tests/omprog-output-capture-mt.sh
+@@ -24,7 +24,7 @@ else
+ LINE_LENGTH=511 # 512 minus 1 byte (for the newline char)
+ fi
+
+-export command_line="/usr/bin/stdbuf -oL -eL $srcdir/testsuites/omprog-output-capture-mt-bin.py $LINE_LENGTH"
++export command_line="/usr/bin/stdbuf -oL $srcdir/testsuites/omprog-output-capture-mt-bin.py $LINE_LENGTH"
+
+ check_command_available stdbuf
+ generate_conf
+diff --git a/tests/testsuites/omprog-output-capture-mt-bin.py b/tests/testsuites/omprog-output-capture-mt-bin.py
+index 6c81da24b..03097f37b 100755
+--- a/tests/testsuites/omprog-output-capture-mt-bin.py
++++ b/tests/testsuites/omprog-output-capture-mt-bin.py
+@@ -10,7 +10,7 @@
+ logLine = sys.stdin.readline()
+ while logLine:
+ logLine = logLine.strip()
+- numRepeats = lineLength / len(logLine)
++ numRepeats = int(lineLength / len(logLine))
+ lineToStdout = (linePrefix + "[stdout] " + logLine*numRepeats)[:lineLength]
+ lineToStderr = (linePrefix + "[stderr] " + logLine*numRepeats)[:lineLength]
+
+@@ -22,16 +22,13 @@
+ # size of the block buffer is generally greater than PIPE_BUF).
+ sys.stdout.write(lineToStdout + "\n")
+
+- # Write to stderr using two writes. Since stderr is unbuffered, each write will be written
+- # immediately to the pipe, and this will cause intermingled lines in the output file.
+- # However, we avoid this by executing this script with 'stdbuf -eL', which forces line
+- # buffering for stderr. We could alternatively do a single write.
+- sys.stderr.write(lineToStderr)
+- sys.stderr.write("\n")
++ # Write to stderr using a single write. Since stderr is unbuffered, each write will be
++ # written immediately (and atomically) to the pipe.
++ sys.stderr.write(lineToStderr + "\n")
+
+- # Note: In future versions of Python3, stderr will possibly be line buffered (see
+- # https://bugs.python.org/issue13601).
+- # Note: When writing to stderr using the Python logging module, it seems that line
++ # Note (FTR): In future versions of Python3, stderr will possibly be line buffered (see
++ # https://bugs.python.org/issue13601). The previous write will also be atomic in this case.
++ # Note (FTR): When writing to stderr using the Python logging module, it seems that line
+ # buffering is also used (although this could depend on the Python version).
+
+ logLine = sys.stdin.readline()
diff --git a/app-admin/rsyslog/rsyslog-8.38.0.ebuild b/app-admin/rsyslog/rsyslog-8.38.0.ebuild
index 6df02d0bab47..c8801a0aef2b 100644
--- a/app-admin/rsyslog/rsyslog-8.38.0.ebuild
+++ b/app-admin/rsyslog/rsyslog-8.38.0.ebuild
@@ -23,7 +23,7 @@ else
doc? ( https://www.rsyslog.com/files/download/${PN}/${PN}-doc-${PV}.tar.gz )
"
- PATCHES=()
+ PATCHES=( "${FILESDIR}"/${P}-fix-omprog-output-capture-mt-test.patch )
fi
LICENSE="GPL-3 LGPL-3 Apache-2.0"