From d030d9bcf60d548c9397c1c1acdc5d9bf1a14862 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 22 Nov 2021 21:34:29 +0100 Subject: [PATCH] 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 --- lib/bup/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))) -- 2.39.2