1 |
commit: a6b83f082a08073c99ad5e8b0a8564fb30083816 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 20 22:36:53 2018 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 20 22:37:15 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6b83f08 |
7 |
|
8 |
app-admin/rsyslog: fix omprog-output-capture-mt test when using Py3 |
9 |
|
10 |
Package-Manager: Portage-2.3.49, Repoman-2.3.10 |
11 |
|
12 |
...-8.38.0-fix-omprog-output-capture-mt-test.patch | 66 ++++++++++++++++++++++ |
13 |
app-admin/rsyslog/rsyslog-8.38.0.ebuild | 2 +- |
14 |
2 files changed, 67 insertions(+), 1 deletion(-) |
15 |
|
16 |
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 |
17 |
new file mode 100644 |
18 |
index 00000000000..c78e0e502d4 |
19 |
--- /dev/null |
20 |
+++ b/app-admin/rsyslog/files/rsyslog-8.38.0-fix-omprog-output-capture-mt-test.patch |
21 |
@@ -0,0 +1,66 @@ |
22 |
+From 0b0a1262f2b401ea16b7d0b36d8254c500cb9d8e Mon Sep 17 00:00:00 2001 |
23 |
+From: Joan Sala <jsiwrk@×××××.com> |
24 |
+Date: Thu, 20 Sep 2018 22:37:58 +0200 |
25 |
+Subject: [PATCH] testbench: fix incompatibility of one omprog test with |
26 |
+ Python3 |
27 |
+ |
28 |
+Python3 writes to stderr immediately, and this caused the |
29 |
+captured output to differ with respect to Python2. Simplified |
30 |
+the test to do a single write to stderr. Also a cast to int |
31 |
+was needed when calculating 'numRepeats'. |
32 |
+ |
33 |
+closes #3030 |
34 |
+--- |
35 |
+ tests/omprog-output-capture-mt.sh | 2 +- |
36 |
+ .../testsuites/omprog-output-capture-mt-bin.py | 17 +++++++---------- |
37 |
+ 2 files changed, 8 insertions(+), 11 deletions(-) |
38 |
+ |
39 |
+diff --git a/tests/omprog-output-capture-mt.sh b/tests/omprog-output-capture-mt.sh |
40 |
+index 50f5c6354..080fabd2a 100755 |
41 |
+--- a/tests/omprog-output-capture-mt.sh |
42 |
++++ b/tests/omprog-output-capture-mt.sh |
43 |
+@@ -24,7 +24,7 @@ else |
44 |
+ LINE_LENGTH=511 # 512 minus 1 byte (for the newline char) |
45 |
+ fi |
46 |
+ |
47 |
+-export command_line="/usr/bin/stdbuf -oL -eL $srcdir/testsuites/omprog-output-capture-mt-bin.py $LINE_LENGTH" |
48 |
++export command_line="/usr/bin/stdbuf -oL $srcdir/testsuites/omprog-output-capture-mt-bin.py $LINE_LENGTH" |
49 |
+ |
50 |
+ check_command_available stdbuf |
51 |
+ generate_conf |
52 |
+diff --git a/tests/testsuites/omprog-output-capture-mt-bin.py b/tests/testsuites/omprog-output-capture-mt-bin.py |
53 |
+index 6c81da24b..03097f37b 100755 |
54 |
+--- a/tests/testsuites/omprog-output-capture-mt-bin.py |
55 |
++++ b/tests/testsuites/omprog-output-capture-mt-bin.py |
56 |
+@@ -10,7 +10,7 @@ |
57 |
+ logLine = sys.stdin.readline() |
58 |
+ while logLine: |
59 |
+ logLine = logLine.strip() |
60 |
+- numRepeats = lineLength / len(logLine) |
61 |
++ numRepeats = int(lineLength / len(logLine)) |
62 |
+ lineToStdout = (linePrefix + "[stdout] " + logLine*numRepeats)[:lineLength] |
63 |
+ lineToStderr = (linePrefix + "[stderr] " + logLine*numRepeats)[:lineLength] |
64 |
+ |
65 |
+@@ -22,16 +22,13 @@ |
66 |
+ # size of the block buffer is generally greater than PIPE_BUF). |
67 |
+ sys.stdout.write(lineToStdout + "\n") |
68 |
+ |
69 |
+- # Write to stderr using two writes. Since stderr is unbuffered, each write will be written |
70 |
+- # immediately to the pipe, and this will cause intermingled lines in the output file. |
71 |
+- # However, we avoid this by executing this script with 'stdbuf -eL', which forces line |
72 |
+- # buffering for stderr. We could alternatively do a single write. |
73 |
+- sys.stderr.write(lineToStderr) |
74 |
+- sys.stderr.write("\n") |
75 |
++ # Write to stderr using a single write. Since stderr is unbuffered, each write will be |
76 |
++ # written immediately (and atomically) to the pipe. |
77 |
++ sys.stderr.write(lineToStderr + "\n") |
78 |
+ |
79 |
+- # Note: In future versions of Python3, stderr will possibly be line buffered (see |
80 |
+- # https://bugs.python.org/issue13601). |
81 |
+- # Note: When writing to stderr using the Python logging module, it seems that line |
82 |
++ # Note (FTR): In future versions of Python3, stderr will possibly be line buffered (see |
83 |
++ # https://bugs.python.org/issue13601). The previous write will also be atomic in this case. |
84 |
++ # Note (FTR): When writing to stderr using the Python logging module, it seems that line |
85 |
+ # buffering is also used (although this could depend on the Python version). |
86 |
+ |
87 |
+ logLine = sys.stdin.readline() |
88 |
|
89 |
diff --git a/app-admin/rsyslog/rsyslog-8.38.0.ebuild b/app-admin/rsyslog/rsyslog-8.38.0.ebuild |
90 |
index 6df02d0bab4..c8801a0aef2 100644 |
91 |
--- a/app-admin/rsyslog/rsyslog-8.38.0.ebuild |
92 |
+++ b/app-admin/rsyslog/rsyslog-8.38.0.ebuild |
93 |
@@ -23,7 +23,7 @@ else |
94 |
doc? ( https://www.rsyslog.com/files/download/${PN}/${PN}-doc-${PV}.tar.gz ) |
95 |
" |
96 |
|
97 |
- PATCHES=() |
98 |
+ PATCHES=( "${FILESDIR}"/${P}-fix-omprog-output-capture-mt-test.patch ) |
99 |
fi |
100 |
|
101 |
LICENSE="GPL-3 LGPL-3 Apache-2.0" |