public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Thomas Deutschmann" <whissi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/rsyslog/, app-admin/rsyslog/files/
Date: Thu, 20 Sep 2018 22:37:22 +0000 (UTC)	[thread overview]
Message-ID: <1537483035.a6b83f082a08073c99ad5e8b0a8564fb30083816.whissi@gentoo> (raw)

commit:     a6b83f082a08073c99ad5e8b0a8564fb30083816
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 20 22:36:53 2018 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Sep 20 22:37:15 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6b83f08

app-admin/rsyslog: fix omprog-output-capture-mt test when using Py3

Package-Manager: Portage-2.3.49, Repoman-2.3.10

 ...-8.38.0-fix-omprog-output-capture-mt-test.patch | 66 ++++++++++++++++++++++
 app-admin/rsyslog/rsyslog-8.38.0.ebuild            |  2 +-
 2 files changed, 67 insertions(+), 1 deletion(-)

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 00000000000..c78e0e502d4
--- /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 6df02d0bab4..c8801a0aef2 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"


             reply	other threads:[~2018-09-20 22:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 22:37 Thomas Deutschmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-11-03 22:42 [gentoo-commits] repo/gentoo:master commit in: app-admin/rsyslog/, app-admin/rsyslog/files/ Thomas Deutschmann
2019-04-05 23:53 Thomas Deutschmann
2019-04-06  0:15 Thomas Deutschmann
2021-10-21 18:08 Thomas Deutschmann
2022-10-24 15:21 Maciej Barć
2023-02-13 22:42 Maciej Barć
2024-06-24 20:08 Maciej Barć

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1537483035.a6b83f082a08073c99ad5e8b0a8564fb30083816.whissi@gentoo \
    --to=whissi@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox