[Reportbug-commits] [reportbug] 05/27: utils.py: Avoid unwanted newlines

Sandro Tosi morph at moszumanska.debian.org
Mon May 29 20:14:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository reportbug.

commit c98301db6049b349580b07b1b5e87bda0e03eb09
Author: Nis Martensen <nis.martensen at web.de>
Date:   Tue Apr 25 22:30:40 2017 +0200

    utils.py: Avoid unwanted newlines
    
    In contrast to subprocess.getoutput(), the new get_command_output()
    function does not strip trailing newlines from the returned output.
    Failure to account for this in the utils/get_arch() function caused
    various subtle breakage in multiple places.
    
    Strip newlines in get_arch() to fix the resulting problems in
    bin/reportbug, reportbug/checkbuildd.py, reportbug/checkversions.py and
    reportbug/debbugs.py.
    
    In lsb_release_info(), do not add the (now unnecessary) additional
    newline.
---
 reportbug/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/reportbug/utils.py b/reportbug/utils.py
index e238a8d..af63814 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -789,11 +789,11 @@ def get_debian_release_info():
 
 
 def lsb_release_info():
-    return get_command_output('lsb_release -a 2>/dev/null') + '\n'
+    return get_command_output('lsb_release -a 2>/dev/null')
 
 
 def get_arch():
-    arch = get_command_output('COLUMNS=79 dpkg --print-architecture 2>/dev/null')
+    arch = get_command_output('COLUMNS=79 dpkg --print-architecture 2>/dev/null').strip()
     if not arch:
         un = os.uname()
         arch = un[4]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reportbug/reportbug.git



More information about the Reportbug-commits mailing list