From: Johannes Berg Date: Mon, 22 Nov 2021 20:34:29 +0000 (+0100) Subject: main: fix output string truncation X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=d030d9bcf60d548c9397c1c1acdc5d9bf1a14862 main: fix output string truncation There's a bug here that causes output to be cut off if it's if the line was too long, in that case 'width' chars would be removed at the beginning, rather than actually showing 'width' chars. Fix that. Reported-by: Nix Fixes: 00fb1f1b2a53 ("Clean subprocess output without newliner") Signed-off-by: Johannes Berg Reviewed-by: Rob Browning --- diff --git a/lib/bup/main.py b/lib/bup/main.py index 746fce4..dcab41b 100755 --- a/lib/bup/main.py +++ b/lib/bup/main.py @@ -219,7 +219,7 @@ def print_clean_line(dest, content, width, sep=None): assert not sep_rx.match(x) content = b''.join(content) if sep == b'\r' and len(content) > width: - content = content[width:] + content = content[:width] os.write(dest, content) if len(content) < width: os.write(dest, b' ' * (width - len(content)))