BaseTools:Double carriage return inserted from Trim.py on Python3

https://bugzilla.tianocore.org/show_bug.cgi?id=1379

Line 208 of BaseTools/Source/Python/Trim/Trim.py uses
'NewLines.append(os.linesep)' to insert a new line into
the list that will be written to the output file.
This causes the '\r\n' inserted with os.linesep to be
written as '\r\r\n', causing some assemblers to error.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Zhiju Fan 2019-01-11 13:04:44 +08:00 committed by Feng, Bob C
parent 31e3eeb5e3
commit 62cb98c254
1 changed files with 1 additions and 1 deletions

View File

@ -205,7 +205,7 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong):
else:
if LineNumber > (len(NewLines) + 1):
for LineIndex in range(len(NewLines), LineNumber-1):
NewLines.append(os.linesep)
NewLines.append(TAB_LINE_BREAK)
NewLines.append(Line)
LineNumber = None
EdkLogger.verbose("Now we have lines: %d" % len(NewLines))