Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Convert carriage returns to newlines in reviews
Browse files Browse the repository at this point in the history
Spotbugs prints multiple lines with \r [1][2]. This looks like a single
line for shell commands but will be converted to multiple lines once
read by Python.

By performing the conversion before the tail command, we will get a
consistent line count in Bash and Python.

[1] https://github.com/spotbugs/spotbugs/blob/fe8a8d66e97d3ae0b830731461aab0f8b39791f6/spotbugs/src/main/java/edu/umd/cs/findbugs/TextUIProgressCallback.java#L103
[2] spotbugs/spotbugs#506

Bugs closed: AURORA-1961

Reviewed at https://reviews.apache.org/r/64508/
  • Loading branch information
StephanErb committed Dec 12, 2017
1 parent ef24c2c commit 0cdaa15
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build-support/jenkins/review_feedback.py
Expand Up @@ -172,10 +172,13 @@ def process(self, review_request):
# Pipe to a file in case output is large, also tee the output to simplify
# debugging. Since we pipe the output, we must set pipefail to ensure
# a failing build command fails the bash pipeline.
# AURORA-1961: Convert carriage returns to newlines to prevent shell cmds
# seing spotbugs output on a single line, which is then translated to
# multiple lines by Python subprocess.
result = subprocess.call([
'bash',
'-c',
'set -o pipefail; %s 2>&1 | tee %s' % (self._command, build_output)])
'set -o pipefail; %s 2>&1 | tr -u "\r" "\n" | tee %s' % (self._command, build_output)])
if result == 0:
review_text = 'Master (%s) is green with this patch.\n %s' % (sha, self._command)
if self._missing_tests(latest_diff):
Expand Down

0 comments on commit 0cdaa15

Please sign in to comment.